diff options
author | wpaul <wpaul@FreeBSD.org> | 2004-02-10 23:01:53 +0000 |
---|---|---|
committer | wpaul <wpaul@FreeBSD.org> | 2004-02-10 23:01:53 +0000 |
commit | 5280743f492aea0d78704ccca6afe522cb67061d (patch) | |
tree | ce510f9fea0460e1c98c7b76502691134d3ff0e3 /sys/compat | |
parent | 640645291f5093248c108bd09bf80671b37279bb (diff) | |
download | FreeBSD-src-5280743f492aea0d78704ccca6afe522cb67061d.zip FreeBSD-src-5280743f492aea0d78704ccca6afe522cb67061d.tar.gz |
Add some bulletproofing: don't allow the ndis_get_info() or ndis_set_info()
routines to do anything except return error if the miniport adapter context
is not set (meaning we either having init'ed the driver yet, or the
initialization failed).
Also, be sure to NULL out the adapter context along with the
miniport characteristics pointers if calling the MiniportInitialize()
method fails.
Diffstat (limited to 'sys/compat')
-rw-r--r-- | sys/compat/ndis/kern_ndis.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/compat/ndis/kern_ndis.c b/sys/compat/ndis/kern_ndis.c index 9ce8132..3483441 100644 --- a/sys/compat/ndis/kern_ndis.c +++ b/sys/compat/ndis/kern_ndis.c @@ -991,6 +991,9 @@ ndis_set_info(arg, oid, buf, buflen) setfunc = sc->ndis_chars.nmc_setinfo_func; adapter = sc->ndis_block.nmb_miniportadapterctx; + if (adapter == NULL) + return(ENXIO); + rval = setfunc(adapter, oid, buf, *buflen, &byteswritten, &bytesneeded); @@ -1272,6 +1275,7 @@ ndis_init_nic(arg) if (status != NDIS_STATUS_SUCCESS) { bzero((char *)&sc->ndis_chars, sizeof(ndis_miniport_characteristics)); + sc->ndis_block.nmb_miniportadapterctx = NULL; return(ENXIO); } @@ -1380,6 +1384,9 @@ ndis_get_info(arg, oid, buf, buflen) queryfunc = sc->ndis_chars.nmc_queryinfo_func; adapter = sc->ndis_block.nmb_miniportadapterctx; + if (adapter == NULL) + return(ENXIO); + rval = queryfunc(adapter, oid, buf, *buflen, &byteswritten, &bytesneeded); |