From owner-svn-src-all@freebsd.org Mon Sep 9 18:07:32 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 85F97DA67E; Mon, 9 Sep 2019 18:07:32 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46Rx2r301jz4LD4; Mon, 9 Sep 2019 18:07:32 +0000 (UTC) (envelope-from erj@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 49CF219774; Mon, 9 Sep 2019 18:07:32 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x89I7Ws0002059; Mon, 9 Sep 2019 18:07:32 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x89I7W5l002058; Mon, 9 Sep 2019 18:07:32 GMT (envelope-from erj@FreeBSD.org) Message-Id: <201909091807.x89I7W5l002058@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Mon, 9 Sep 2019 18:07:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r352091 - stable/11/sys/net X-SVN-Group: stable-11 X-SVN-Commit-Author: erj X-SVN-Commit-Paths: stable/11/sys/net X-SVN-Commit-Revision: 352091 X-SVN-Commit-Repository: base 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.29 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: Mon, 09 Sep 2019 18:07:32 -0000 Author: erj Date: Mon Sep 9 18:07:31 2019 New Revision: 352091 URL: https://svnweb.freebsd.org/changeset/base/352091 Log: iflib: initialize the STATE_LOCK in iflib_register From Jake: r347197 contained an MFC for r332389, adding the STATE_LOCK to the iflib core driver. Unfortunately, the commit accidentally missed adding the STATE_LOCK_INIT. Without this, if you build a STABLE-11 kernel with INVARIANTS enabled, any mtx_lock of the state lock will result in a panic: panic: mtx_lock() of spin mutex (null) @ /usr/src/sys/net/iflib.c:5522 It actually ends up looking like a panic due to taking a spin mutex when we could be interrupted. However, the real cause is because the lock class was never initialized. Initialize the STATE_LOCK properly during iflib_register to fix this. Submitted by: Jacob Keller Reviewed by: erj@ Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D21540 Modified: stable/11/sys/net/iflib.c Modified: stable/11/sys/net/iflib.c ============================================================================== --- stable/11/sys/net/iflib.c Mon Sep 9 18:01:07 2019 (r352090) +++ stable/11/sys/net/iflib.c Mon Sep 9 18:07:31 2019 (r352091) @@ -4758,6 +4758,7 @@ iflib_register(if_ctx_t ctx) _iflib_assert(sctx); CTX_LOCK_INIT(ctx, device_get_nameunit(ctx->ifc_dev)); + STATE_LOCK_INIT(ctx, device_get_nameunit(ctx->ifc_dev)); ifp = ctx->ifc_ifp = if_alloc(IFT_ETHER); if (ifp == NULL) {