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.
This commit is contained in:
parent
640645291f
commit
5280743f49
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user