From 9c9191983b7368570cb5f285adf9887d8eb773e7 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Sat, 5 Apr 2008 17:24:44 +0000 Subject: During attach on some de(4) adapters the driver sends out a test packet as part of detecting the media. Explicitly ensure that we don't send it to bpf(4) as bpf(4) isn't setup yet. This worked by accident before the bpf interface stuff was reworked to avoid other races (bpf_peers_present, etc.) but now it needs an explicit check to avoid a panic. MFC after: 3 days PR: kern/120915 --- sys/dev/de/if_de.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'sys') diff --git a/sys/dev/de/if_de.c b/sys/dev/de/if_de.c index 35032897f73c..81335c12e1c3 100644 --- a/sys/dev/de/if_de.c +++ b/sys/dev/de/if_de.c @@ -4053,7 +4053,8 @@ tulip_txput(tulip_softc_t * const sc, struct mbuf *m) /* * bounce a copy to the bpf listener, if any. */ - BPF_MTAP(sc->tulip_ifp, m); + if (!(sc->tulip_flags & TULIP_DEVICEPROBE)) + BPF_MTAP(sc->tulip_ifp, m); /* * The descriptors have been filled in. Now get ready @@ -4437,13 +4438,16 @@ tulip_attach(tulip_softc_t * const sc) ifmedia_init(&sc->tulip_ifmedia, 0, tulip_ifmedia_change, tulip_ifmedia_status); - sc->tulip_flags &= ~TULIP_DEVICEPROBE; tulip_ifmedia_add(sc); tulip_reset(sc); TULIP_UNLOCK(sc); ether_ifattach(sc->tulip_ifp, sc->tulip_enaddr); + + TULIP_LOCK(sc); + sc->tulip_flags &= ~TULIP_DEVICEPROBE; + TULIP_UNLOCK(sc); } /* Release memory for a single descriptor ring. */ -- cgit v1.3