svn commit: r250945 - head/sys/net

Guy Helmer ghelmer at FreeBSD.org
Thu May 23 21:33:11 UTC 2013


Author: ghelmer
Date: Thu May 23 21:33:10 2013
New Revision: 250945
URL: http://svnweb.freebsd.org/changeset/base/250945

Log:
  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

Modified:
  head/sys/net/bpf.c

Modified: head/sys/net/bpf.c
==============================================================================
--- head/sys/net/bpf.c	Thu May 23 21:07:26 2013	(r250944)
+++ head/sys/net/bpf.c	Thu May 23 21:33:10 2013	(r250945)
@@ -856,9 +856,14 @@ bpfread(struct cdev *dev, struct uio *ui
 		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


More information about the svn-src-head mailing list