Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Sep 2019 18:07:32 +0000 (UTC)
From:      Eric Joyner <erj@FreeBSD.org>
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
Message-ID:  <201909091807.x89I7W5l002058@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 <jacob.e.keller@intel.com>
  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) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201909091807.x89I7W5l002058>