⬢ DragonFlyBSD Kernel Audit
DF-2347 / fix.diff
← back to finding ↓ download raw
--- a/sys/bus/u4b/usb_pf.c
+++ b/sys/bus/u4b/usb_pf.c
@@ -352,6 +352,7 @@
 	uint32_t frame;
 	uint32_t temp;
 	uint32_t nframes;
+	struct ifnet *ifp;
 	uint32_t x;
 	uint8_t *buf;
 	uint8_t *ptr;
@@ -359,7 +360,8 @@
 	bus = xfer->xroot->bus;
 
 	/* sanity checks */
-	if (bus->ifp == NULL)
+	ifp = bus->ifp;		/* read once: clone-destroy may clear it */
+	if (ifp == NULL)
 		return;
 #if 0 /* XXX this is not needed on dragonfly */
 	if (!bpf_peers_present(bus->ifp->if_bpf))
@@ -485,7 +487,7 @@
 		}
 	}
 
-	bpf_tap(bus->ifp->if_bpf, buf, totlen);
+	bpf_tap(ifp->if_bpf, buf, totlen);
 
 	kfree(buf, M_TEMP);
 }