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);
 }
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to