svn commit: r346602 - head/sys/net

2019-09-03 Thread Kyle Evans
Author: kevans
Date: Tue Apr 23 17:28:28 2019
New Revision: 346602
URL: https://svnweb.freebsd.org/changeset/base/346602

Log:
  tun(4): Defer clearing TUN_OPEN until much later
  
  tun destruction will not continue until TUN_OPEN is cleared. There are brief
  moments in tunclose where the mutex is dropped and we've already cleared
  TUN_OPEN, so tun_destroy would be able to proceed while we're in the middle
  of cleaning up the tun still. tun_destroy should be blocked until these
  parts (address/route purges, mostly) are complete.
  
  PR:   233955
  MFC after:2 weeks

Modified:
  head/sys/net/if_tun.c

Modified: head/sys/net/if_tun.c
==
--- head/sys/net/if_tun.c   Tue Apr 23 17:18:20 2019(r346601)
+++ head/sys/net/if_tun.c   Tue Apr 23 17:28:28 2019(r346602)
@@ -500,8 +500,6 @@ tunclose(struct cdev *dev, int foo, int bar, struct th
ifp = TUN2IFP(tp);
 
mtx_lock(&tp->tun_mtx);
-   tp->tun_flags &= ~TUN_OPEN;
-   tp->tun_pid = 0;
 
/*
 * junk all pending output
@@ -540,6 +538,8 @@ tunclose(struct cdev *dev, int foo, int bar, struct th
selwakeuppri(&tp->tun_rsel, PZERO + 1);
KNOTE_LOCKED(&tp->tun_rsel.si_note, 0);
TUNDEBUG (ifp, "closed\n");
+   tp->tun_flags &= ~TUN_OPEN;
+   tp->tun_pid = 0;
 
cv_broadcast(&tp->tun_cv);
mtx_unlock(&tp->tun_mtx);


___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r346602 - head/sys/net

2019-04-23 Thread Kyle Evans
Author: kevans
Date: Tue Apr 23 17:28:28 2019
New Revision: 346602
URL: https://svnweb.freebsd.org/changeset/base/346602

Log:
  tun(4): Defer clearing TUN_OPEN until much later
  
  tun destruction will not continue until TUN_OPEN is cleared. There are brief
  moments in tunclose where the mutex is dropped and we've already cleared
  TUN_OPEN, so tun_destroy would be able to proceed while we're in the middle
  of cleaning up the tun still. tun_destroy should be blocked until these
  parts (address/route purges, mostly) are complete.
  
  PR:   233955
  MFC after:2 weeks

Modified:
  head/sys/net/if_tun.c

Modified: head/sys/net/if_tun.c
==
--- head/sys/net/if_tun.c   Tue Apr 23 17:18:20 2019(r346601)
+++ head/sys/net/if_tun.c   Tue Apr 23 17:28:28 2019(r346602)
@@ -500,8 +500,6 @@ tunclose(struct cdev *dev, int foo, int bar, struct th
ifp = TUN2IFP(tp);
 
mtx_lock(&tp->tun_mtx);
-   tp->tun_flags &= ~TUN_OPEN;
-   tp->tun_pid = 0;
 
/*
 * junk all pending output
@@ -540,6 +538,8 @@ tunclose(struct cdev *dev, int foo, int bar, struct th
selwakeuppri(&tp->tun_rsel, PZERO + 1);
KNOTE_LOCKED(&tp->tun_rsel.si_note, 0);
TUNDEBUG (ifp, "closed\n");
+   tp->tun_flags &= ~TUN_OPEN;
+   tp->tun_pid = 0;
 
cv_broadcast(&tp->tun_cv);
mtx_unlock(&tp->tun_mtx);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"