diff options
author | ru <ru@FreeBSD.org> | 2005-11-14 18:19:57 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2005-11-14 18:19:57 +0000 |
commit | 96c796ea3f16c4187623c86aa709b08362521155 (patch) | |
tree | 17b90a87cbde342bcd1ae1e0cc72f2b163cae265 | |
parent | 8129d1a5f520c7106669686aef79317ea52ec52f (diff) | |
download | FreeBSD-src-96c796ea3f16c4187623c86aa709b08362521155.zip FreeBSD-src-96c796ea3f16c4187623c86aa709b08362521155.tar.gz |
Unlike the rest of the world, NDIS code can access "struct
ifnet" before is has been fully initialized by if_attach().
Account for that to avoid a null pointer dereference.
-rw-r--r-- | sys/compat/ndis/subr_ndis.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/compat/ndis/subr_ndis.c b/sys/compat/ndis/subr_ndis.c index de50ce3..4ce9259 100644 --- a/sys/compat/ndis/subr_ndis.c +++ b/sys/compat/ndis/subr_ndis.c @@ -1410,7 +1410,8 @@ NdisReadNetworkAddress(status, addr, addrlen, adapter) #ifdef IFP2ENADDR if (bcmp(IFP2ENADDR(sc->ifp), empty, ETHER_ADDR_LEN) == 0) #elif __FreeBSD_version >= 700000 - if (bcmp(IF_LLADDR(sc->ifp), empty, ETHER_ADDR_LEN) == 0) + if (sc->ifp->if_addr == NULL || + bcmp(IF_LLADDR(sc->ifp), empty, ETHER_ADDR_LEN) == 0) #else if (bcmp(sc->arpcom.ac_enaddr, empty, ETHER_ADDR_LEN) == 0) #endif |