summaryrefslogtreecommitdiffstats
path: root/sys/net/bpf.c
diff options
context:
space:
mode:
authorghelmer <ghelmer@FreeBSD.org>2013-05-23 21:33:10 +0000
committerghelmer <ghelmer@FreeBSD.org>2013-05-23 21:33:10 +0000
commit37dcf710d19543462c119ba640fee8b6d67a88ff (patch)
tree05d2e41009eb185be33a6206b98ce1d3ac9fd58a /sys/net/bpf.c
parent4a0d14c9b4f528ea5ab081d3ee4a7c3d56549555 (diff)
downloadFreeBSD-src-37dcf710d19543462c119ba640fee8b6d67a88ff.zip
FreeBSD-src-37dcf710d19543462c119ba640fee8b6d67a88ff.tar.gz
While waiting for the bpf hold buffer to become idle, check
the return value from mtx_sleep() and exit bpfread() on errors such as EINTR. Reviewed by: jhb
Diffstat (limited to 'sys/net/bpf.c')
-rw-r--r--sys/net/bpf.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index ce83e4a..cb3ed27 100644
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -856,9 +856,14 @@ bpfread(struct cdev *dev, struct uio *uio, int ioflag)
callout_stop(&d->bd_callout);
timed_out = (d->bd_state == BPF_TIMED_OUT);
d->bd_state = BPF_IDLE;
- while (d->bd_hbuf_in_use)
- mtx_sleep(&d->bd_hbuf_in_use, &d->bd_lock,
+ while (d->bd_hbuf_in_use) {
+ error = mtx_sleep(&d->bd_hbuf_in_use, &d->bd_lock,
PRINET|PCATCH, "bd_hbuf", 0);
+ if (error != 0) {
+ BPFD_UNLOCK(d);
+ return (error);
+ }
+ }
/*
* If the hold buffer is empty, then do a timed sleep, which
* ends when the timeout expires or when enough packets
OpenPOWER on IntegriCloud