Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net Prevent a race between tap_dev_poll() and tap_start(...



details:   https://anonhg.NetBSD.org/src/rev/97e07694c9ab
branches:  trunk
changeset: 329110:97e07694c9ab
user:      cube <cube%NetBSD.org@localhost>
date:      Wed May 07 22:53:34 2014 +0000

description:
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.

diffstat:

 sys/net/if_tap.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (34 lines):

diff -r 8552d00fb38c -r 97e07694c9ab sys/net/if_tap.c
--- a/sys/net/if_tap.c  Wed May 07 19:30:09 2014 +0000
+++ b/sys/net/if_tap.c  Wed May 07 22:53:34 2014 +0000
@@ -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 @@
 
                s = splnet();
                IFQ_POLL(&ifp->if_snd, m);
-               splx(s);
 
                if (m != NULL)
                        revents |= events & (POLLIN|POLLRDNORM);
@@ -1191,6 +1190,7 @@
                        selrecord(l, &sc->sc_rsel);
                        mutex_spin_exit(&sc->sc_kqlock);
                }
+               splx(s);
        }
        revents |= events & (POLLOUT|POLLWRNORM);
 



Home | Main Index | Thread Index | Old Index