Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 Jan 2015 16:26:29 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r277759 - in head/sys: dev/cxgbe kern
Message-ID:  <201501261626.t0QGQTUr032990@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Mon Jan 26 16:26:28 2015
New Revision: 277759
URL: https://svnweb.freebsd.org/changeset/base/277759

Log:
  Fix a couple of panics when detaching from a cxgbe/cxl interface that was
  never brought up:
  - Allow NULL to be passed to sglist_free().
  - Don't try to stop an interface that was never fully initialized.
  
  Reviewed by:	np

Modified:
  head/sys/dev/cxgbe/t4_main.c
  head/sys/kern/subr_sglist.c

Modified: head/sys/dev/cxgbe/t4_main.c
==============================================================================
--- head/sys/dev/cxgbe/t4_main.c	Mon Jan 26 15:47:08 2015	(r277758)
+++ head/sys/dev/cxgbe/t4_main.c	Mon Jan 26 16:26:28 2015	(r277759)
@@ -3292,6 +3292,12 @@ cxgbe_uninit_synchronized(struct port_in
 
 	ASSERT_SYNCHRONIZED_OP(sc);
 
+	if (!(pi->flags & PORT_INIT_DONE)) {
+		KASSERT(!(ifp->if_drv_flags & IFF_DRV_RUNNING),
+		    ("uninited port is running"));
+		return (0);
+	}
+
 	/*
 	 * Disable the VI so that all its data in either direction is discarded
 	 * by the MPS.  Leave everything else (the queues, interrupts, and 1Hz

Modified: head/sys/kern/subr_sglist.c
==============================================================================
--- head/sys/kern/subr_sglist.c	Mon Jan 26 15:47:08 2015	(r277758)
+++ head/sys/kern/subr_sglist.c	Mon Jan 26 16:26:28 2015	(r277759)
@@ -216,6 +216,9 @@ void
 sglist_free(struct sglist *sg)
 {
 
+	if (sg == NULL)
+		return;
+
 	if (refcount_release(&sg->sg_refs))
 		free(sg, M_SGLIST);
 }



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