svn commit: r352091 - stable/11/sys/net

Eric Joyner erj at FreeBSD.org
Mon Sep 9 18:07:32 UTC 2019


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 at 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) {


More information about the svn-src-all mailing list