summaryrefslogtreecommitdiffstats
path: root/sys/net/bpf.c
diff options
context:
space:
mode:
authorbz <bz@FreeBSD.org>2010-04-27 15:16:54 +0000
committerbz <bz@FreeBSD.org>2010-04-27 15:16:54 +0000
commit7fcd42cfee8558342ba8a17f56aa25fc53bac879 (patch)
treee405e29929cea425291bb3ce2ac04cdf70c5c2d8 /sys/net/bpf.c
parentc7fd54ae5aaa23136f70d1bc2685cdc3e78a315e (diff)
downloadFreeBSD-src-7fcd42cfee8558342ba8a17f56aa25fc53bac879.zip
FreeBSD-src-7fcd42cfee8558342ba8a17f56aa25fc53bac879.tar.gz
MFP4: @177254
Add missing CURVNET_RESTORE() calls for multiple code paths, to stop leaking the currently cached vnet into callers and to the process. Sponsored by: The FreeBSD Foundation Sponsored by: CK Software GmbH MFC after: 4 days
Diffstat (limited to 'sys/net/bpf.c')
-rw-r--r--sys/net/bpf.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index 1755ec7..16245c9 100644
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -1454,6 +1454,7 @@ bpfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags,
/* FALLSTHROUGH */
default:
+ CURVNET_RESTORE();
return (EINVAL);
}
@@ -1461,6 +1462,7 @@ bpfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags,
if (d->bd_sbuf != NULL || d->bd_hbuf != NULL ||
d->bd_fbuf != NULL || d->bd_bif != NULL) {
BPFD_UNLOCK(d);
+ CURVNET_RESTORE();
return (EBUSY);
}
d->bd_bufmode = *(u_int *)addr;
@@ -1468,13 +1470,16 @@ bpfioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flags,
break;
case BIOCGETZMAX:
- return (bpf_ioctl_getzmax(td, d, (size_t *)addr));
+ error = bpf_ioctl_getzmax(td, d, (size_t *)addr);
+ break;
case BIOCSETZBUF:
- return (bpf_ioctl_setzbuf(td, d, (struct bpf_zbuf *)addr));
+ error = bpf_ioctl_setzbuf(td, d, (struct bpf_zbuf *)addr);
+ break;
case BIOCROTZBUF:
- return (bpf_ioctl_rotzbuf(td, d, (struct bpf_zbuf *)addr));
+ error = bpf_ioctl_rotzbuf(td, d, (struct bpf_zbuf *)addr);
+ break;
}
CURVNET_RESTORE();
return (error);
OpenPOWER on IntegriCloud