Module Name:    src
Committed By:   cube
Date:           Wed May  7 22:53:34 UTC 2014

Modified Files:
        src/sys/net: if_tap.c

Log Message:
Prevent a race between tap_dev_poll() and tap_start() by making sure the
call to selrecord() happens at splnet().  Fixes kern/47506 and kern/46199.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/net/if_tap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net/if_tap.c
diff -u src/sys/net/if_tap.c:1.75 src/sys/net/if_tap.c:1.76
--- src/sys/net/if_tap.c:1.75	Sun Apr 20 22:39:51 2014
+++ src/sys/net/if_tap.c	Wed May  7 22:53:34 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_tap.c,v 1.75 2014/04/20 22:39:51 aymeric Exp $	*/
+/*	$NetBSD: if_tap.c,v 1.76 2014/05/07 22:53:34 cube Exp $	*/
 
 /*
  *  Copyright (c) 2003, 2004, 2008, 2009 The NetBSD Foundation.
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_tap.c,v 1.75 2014/04/20 22:39:51 aymeric Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tap.c,v 1.76 2014/05/07 22:53:34 cube Exp $");
 
 #if defined(_KERNEL_OPT)
 
@@ -1182,7 +1182,6 @@ tap_dev_poll(int unit, int events, struc
 
 		s = splnet();
 		IFQ_POLL(&ifp->if_snd, m);
-		splx(s);
 
 		if (m != NULL)
 			revents |= events & (POLLIN|POLLRDNORM);
@@ -1191,6 +1190,7 @@ tap_dev_poll(int unit, int events, struc
 			selrecord(l, &sc->sc_rsel);
 			mutex_spin_exit(&sc->sc_kqlock);
 		}
+		splx(s);
 	}
 	revents |= events & (POLLOUT|POLLWRNORM);
 

Reply via email to