From owner-svn-src-head@freebsd.org Wed Nov 1 14:27:27 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A35B3E5D113; Wed, 1 Nov 2017 14:27:27 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 72A267090F; Wed, 1 Nov 2017 14:27:27 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vA1ERQjW050051; Wed, 1 Nov 2017 14:27:26 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vA1ERQTp050050; Wed, 1 Nov 2017 14:27:26 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201711011427.vA1ERQTp050050@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Wed, 1 Nov 2017 14:27:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r325283 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 325283 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Nov 2017 14:27:27 -0000 Author: kp Date: Wed Nov 1 14:27:26 2017 New Revision: 325283 URL: https://svnweb.freebsd.org/changeset/base/325283 Log: epair: Fix panic on unload The VNET_SYSUNINIT() callback is executed after the MOD_UNLOAD. That means that netisr_unregister() has already been called when netisr_unregister_vnet() gets calls, leading to an assertion failure. Restore the expected order of operations by performing everything that was done in MOD_UNLOAD to a SYSUNINIT() (that will be called after the VNET_SYSUNINIT()). Differential Revision: https://reviews.freebsd.org/D12771 Modified: head/sys/net/if_epair.c Modified: head/sys/net/if_epair.c ============================================================================== --- head/sys/net/if_epair.c Wed Nov 1 13:54:16 2017 (r325282) +++ head/sys/net/if_epair.c Wed Nov 1 14:27:26 2017 (r325283) @@ -980,6 +980,17 @@ vnet_epair_uninit(const void *unused __unused) VNET_SYSUNINIT(vnet_epair_uninit, SI_SUB_INIT_IF, SI_ORDER_ANY, vnet_epair_uninit, NULL); +static void +epair_uninit(const void *unused __unused) +{ + netisr_unregister(&epair_nh); + epair_dpcpu_detach(); + if (bootverbose) + printf("%s unloaded.\n", epairname); +} +SYSUNINIT(epair_uninit, SI_SUB_INIT_IF, SI_ORDER_MIDDLE, + epair_uninit, NULL); + static int epair_modevent(module_t mod, int type, void *data) { @@ -997,10 +1008,7 @@ epair_modevent(module_t mod, int type, void *data) printf("%s initialized.\n", epairname); break; case MOD_UNLOAD: - netisr_unregister(&epair_nh); - epair_dpcpu_detach(); - if (bootverbose) - printf("%s unloaded.\n", epairname); + /* Handled in epair_uninit() */ break; default: return (EOPNOTSUPP);