summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsam <sam@FreeBSD.org>2003-09-04 22:27:45 +0000
committersam <sam@FreeBSD.org>2003-09-04 22:27:45 +0000
commite33f414d9670f7b7cd680e77f3afbafbb17b8485 (patch)
treeb57d646a08eb23ae0b706cf1b3be160b27d1d856
parentf13029487885696d898e49719d44dc0b4fc173db (diff)
downloadFreeBSD-src-e33f414d9670f7b7cd680e77f3afbafbb17b8485.zip
FreeBSD-src-e33f414d9670f7b7cd680e77f3afbafbb17b8485.tar.gz
Reduce window during which a race can occur when detaching
an interface from each descriptor that references it. This is just a bandaid; the locking here needs to be redone.
-rw-r--r--sys/net/bpf.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index 23a35cc..d5b9d4d 100644
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -278,7 +278,9 @@ bpf_detachd(d)
struct bpf_d **p;
struct bpf_if *bp;
+ /* XXX locking */
bp = d->bd_bif;
+ d->bd_bif = 0;
/*
* Check if this descriptor had requested promiscuous mode.
* If so, turn it off.
@@ -310,9 +312,8 @@ bpf_detachd(d)
/*
* Let the driver know that there are no more listeners.
*/
- *d->bd_bif->bif_driverp = 0;
+ *bp->bif_driverp = 0;
BPFIF_UNLOCK(bp);
- d->bd_bif = 0;
}
/*
OpenPOWER on IntegriCloud