Author: emaste
Date: Thu Jun  5 15:18:49 2014
New Revision: 267112
URL: http://svnweb.freebsd.org/changeset/base/267112

Log:
  MFC r240938, r240942: Avoid INVARIANTS panic destroying an in-use tap(4)
  
    The requirement (implied by the KASSERT in tap_destroy) that the tap is
    closed isn't valid; destroy_dev will block in devdrn while other threads
    are in d_* functions.
  
    Note: if_tun had the same issue, addressed in SVN revisions r186391,
    r186483 and r186497.  The use of the condvar there appears to be
    redundant with the functionality provided by destroy_dev.
  
  PR:           172075
  Approved by:  re

Modified:
  stable/9/sys/net/if_tap.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/net/   (props changed)

Modified: stable/9/sys/net/if_tap.c
==============================================================================
--- stable/9/sys/net/if_tap.c   Thu Jun  5 15:16:44 2014        (r267111)
+++ stable/9/sys/net/if_tap.c   Thu Jun  5 15:18:49 2014        (r267112)
@@ -213,14 +213,10 @@ tap_destroy(struct tap_softc *tp)
 {
        struct ifnet *ifp = tp->tap_ifp;
 
-       /* Unlocked read. */
-       KASSERT(!(tp->tap_flags & TAP_OPEN),
-               ("%s flags is out of sync", ifp->if_xname));
-
        CURVNET_SET(ifp->if_vnet);
+       destroy_dev(tp->tap_dev);
        seldrain(&tp->tap_rsel);
        knlist_destroy(&tp->tap_rsel.si_note);
-       destroy_dev(tp->tap_dev);
        ether_ifdetach(ifp);
        if_free_type(ifp, IFT_ETHER);
 
_______________________________________________
svn-src-stable-9@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9
To unsubscribe, send any mail to "svn-src-stable-9-unsubscr...@freebsd.org"

Reply via email to