Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 May 2013 21:33:10 +0000 (UTC)
From:      Guy Helmer <ghelmer@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r250945 - head/sys/net
Message-ID:  <201305232133.r4NLXAGp091165@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201305232133.r4NLXAGp091165>