summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Smith <mgsmith@netgate.com>2015-11-18 10:33:30 -0600
committerMatt Smith <mgsmith@netgate.com>2015-11-18 10:33:30 -0600
commitb4172ab0e47d86ac0067e87ca3b5b6c46b8450e1 (patch)
tree4d7c024a5a9c8d2be93ac3a5fd1a8f5e63fc3b73
parent95113c0a120cf2b18d306dfffee6a4cc085d9909 (diff)
downloadFreeBSD-src-b4172ab0e47d86ac0067e87ca3b5b6c46b8450e1.zip
FreeBSD-src-b4172ab0e47d86ac0067e87ca3b5b6c46b8450e1.tar.gz
Importing pfSense patch redmine_4685-2.diff
-rw-r--r--sys/net/bpf.c15
-rw-r--r--sys/net/bpf_buffer.c5
2 files changed, 5 insertions, 15 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index cb3ed27..6af3cc7 100644
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -1965,10 +1965,10 @@ filt_bpfread(struct knote *kn, long hint)
ready = bpf_ready(d);
if (ready) {
kn->kn_data = d->bd_slen;
- while (d->bd_hbuf_in_use)
- mtx_sleep(&d->bd_hbuf_in_use, &d->bd_lock,
- PRINET, "bd_hbuf", 0);
- if (d->bd_hbuf)
+ /*
+ * Ignore the hold buffer if it is being copied to user space.
+ */
+ if (!d->bd_hbuf_in_use && d->bd_hbuf)
kn->kn_data += d->bd_hlen;
} else if (d->bd_rtout > 0 && d->bd_state == BPF_IDLE) {
callout_reset(&d->bd_callout, d->bd_rtout,
@@ -2300,9 +2300,6 @@ catchpacket(struct bpf_d *d, u_char *pkt, u_int pktlen, u_int snaplen,
* spot to do it.
*/
if (d->bd_fbuf == NULL && bpf_canfreebuf(d)) {
- while (d->bd_hbuf_in_use)
- mtx_sleep(&d->bd_hbuf_in_use, &d->bd_lock,
- PRINET, "bd_hbuf", 0);
d->bd_fbuf = d->bd_hbuf;
d->bd_hbuf = NULL;
d->bd_hlen = 0;
@@ -2345,9 +2342,7 @@ catchpacket(struct bpf_d *d, u_char *pkt, u_int pktlen, u_int snaplen,
++d->bd_dcount;
return;
}
- while (d->bd_hbuf_in_use)
- mtx_sleep(&d->bd_hbuf_in_use, &d->bd_lock,
- PRINET, "bd_hbuf", 0);
+ KASSERT(!d->bd_hbuf_in_use, ("hold buffer is in use"));
ROTATE_BUFFERS(d);
do_wakeup = 1;
curlen = 0;
diff --git a/sys/net/bpf_buffer.c b/sys/net/bpf_buffer.c
index 74e1ae4..64bb982 100644
--- a/sys/net/bpf_buffer.c
+++ b/sys/net/bpf_buffer.c
@@ -79,8 +79,6 @@ __FBSDID("$FreeBSD$");
#include <net/bpf_buffer.h>
#include <net/bpfdesc.h>
-#define PRINET 26 /* interruptible */
-
/*
* Implement historical kernel memory buffering model for BPF: two malloc(9)
* kernel buffers are hung off of the descriptor. The size is fixed prior to
@@ -191,9 +189,6 @@ bpf_buffer_ioctl_sblen(struct bpf_d *d, u_int *i)
return (EINVAL);
}
- while (d->bd_hbuf_in_use)
- mtx_sleep(&d->bd_hbuf_in_use, &d->bd_lock,
- PRINET, "bd_hbuf", 0);
/* Free old buffers if set */
if (d->bd_fbuf != NULL)
free(d->bd_fbuf, M_BPF);
OpenPOWER on IntegriCloud