diff options
author | wpaul <wpaul@FreeBSD.org> | 2001-05-09 18:22:42 +0000 |
---|---|---|
committer | wpaul <wpaul@FreeBSD.org> | 2001-05-09 18:22:42 +0000 |
commit | 37163a5501446aafd5ab06308ef61069e48ee28d (patch) | |
tree | ca2498bbff8f98cb4546cfce07b8fd2f54ee112f /sys | |
parent | ae1bfe3891a3ec620b5d8376b6bffa47dbd0b379 (diff) | |
download | FreeBSD-src-37163a5501446aafd5ab06308ef61069e48ee28d.zip FreeBSD-src-37163a5501446aafd5ab06308ef61069e48ee28d.tar.gz |
The sk driver developed a bug when the multicast code was changed to
use TAILQ macros. The sk_attach_xmac() routine calls sk_init_xmac()
before doing the transceiver probe, but *before* ether_ifattach()
is called. This causes sk_init_xmac() to call sk_setmulti(), which
tries to do a TAILQ_FOREACH(), which it can't do because ether_ifattach()
hasn't done a TAILQ_INIT() yet. This causes a NULL pointer dereference
and panic in sk_setmulti() at driver load/initialization time.
Fixed by calling ether_ifattach() before the MII probe.
The code in RELENG_4 still uses the old way of enumerating the
multicast list and doesn't have this problem. Yet.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/sk/if_sk.c | 13 | ||||
-rw-r--r-- | sys/pci/if_sk.c | 13 |
2 files changed, 14 insertions, 12 deletions
diff --git a/sys/dev/sk/if_sk.c b/sys/dev/sk/if_sk.c index 4b5e7f6..83d5720 100644 --- a/sys/dev/sk/if_sk.c +++ b/sys/dev/sk/if_sk.c @@ -1148,6 +1148,12 @@ static int sk_attach_xmac(dev) ifp->if_snd.ifq_maxlen = SK_TX_RING_CNT - 1; /* + * Call MI attach routine. + */ + ether_ifattach(ifp, ETHER_BPF_SUPPORTED); + callout_handle_init(&sc_if->sk_tick_ch); + + /* * Do miibus setup. */ sk_init_xmac(sc_if); @@ -1156,16 +1162,11 @@ static int sk_attach_xmac(dev) printf("skc%d: no PHY found!\n", sc_if->sk_unit); contigfree(sc_if->sk_rdata, sizeof(struct sk_ring_data), M_DEVBUF); + ether_ifdetach(ifp, ETHER_BPF_SUPPORTED); SK_UNLOCK(sc); return(ENXIO); } - /* - * Call MI attach routine. - */ - ether_ifattach(ifp, ETHER_BPF_SUPPORTED); - callout_handle_init(&sc_if->sk_tick_ch); - SK_UNLOCK(sc); return(0); diff --git a/sys/pci/if_sk.c b/sys/pci/if_sk.c index 4b5e7f6..83d5720 100644 --- a/sys/pci/if_sk.c +++ b/sys/pci/if_sk.c @@ -1148,6 +1148,12 @@ static int sk_attach_xmac(dev) ifp->if_snd.ifq_maxlen = SK_TX_RING_CNT - 1; /* + * Call MI attach routine. + */ + ether_ifattach(ifp, ETHER_BPF_SUPPORTED); + callout_handle_init(&sc_if->sk_tick_ch); + + /* * Do miibus setup. */ sk_init_xmac(sc_if); @@ -1156,16 +1162,11 @@ static int sk_attach_xmac(dev) printf("skc%d: no PHY found!\n", sc_if->sk_unit); contigfree(sc_if->sk_rdata, sizeof(struct sk_ring_data), M_DEVBUF); + ether_ifdetach(ifp, ETHER_BPF_SUPPORTED); SK_UNLOCK(sc); return(ENXIO); } - /* - * Call MI attach routine. - */ - ether_ifattach(ifp, ETHER_BPF_SUPPORTED); - callout_handle_init(&sc_if->sk_tick_ch); - SK_UNLOCK(sc); return(0); |