summaryrefslogtreecommitdiffstats
path: root/sys/net
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2004-02-29 15:32:33 +0000
committerrwatson <rwatson@FreeBSD.org>2004-02-29 15:32:33 +0000
commitd108afc2e8f67ee2f8cf2ee59b7637118c70f43a (patch)
tree52f910f3c44b62d143f4b595c3d7ecf3340ad8e7 /sys/net
parentd882001178491ecc8b2a865b87643ea794238f0b (diff)
downloadFreeBSD-src-d108afc2e8f67ee2f8cf2ee59b7637118c70f43a.zip
FreeBSD-src-d108afc2e8f67ee2f8cf2ee59b7637118c70f43a.tar.gz
Grab Giant after MAC processing on outgoing packets being sent via
BPF. Grab the BPF descriptor lock before entering MAC since the MAC Framework references BPF descriptor fields, including the BPF descriptor label. Submitted by: sam
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/bpf.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index a24cce9..d010640 100644
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -578,10 +578,12 @@ bpfwrite(dev, uio, ioflag)
if (d->bd_hdrcmplt)
dst.sa_family = pseudo_AF_HDRCMPLT;
- mtx_lock(&Giant);
#ifdef MAC
+ BPFD_LOCK(d);
mac_create_mbuf_from_bpfdesc(d, m);
+ BPFD_UNLOCK(d);
#endif
+ mtx_lock(&Giant);
error = (*ifp->if_output)(ifp, m, &dst, (struct rtentry *)0);
mtx_unlock(&Giant);
/*
OpenPOWER on IntegriCloud