From owner-svn-src-all@FreeBSD.ORG Thu Jun 5 15:18:50 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 67821E71; Thu, 5 Jun 2014 15:18:50 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5405C28BE; Thu, 5 Jun 2014 15:18:50 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s55FIoAQ019793; Thu, 5 Jun 2014 15:18:50 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s55FIoap019792; Thu, 5 Jun 2014 15:18:50 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201406051518.s55FIoap019792@svn.freebsd.org> From: Ed Maste Date: Thu, 5 Jun 2014 15:18:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r267112 - stable/9/sys/net X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Jun 2014 15:18:50 -0000 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);