Author: np
Date: Sun Mar 20 05:01:40 2016
New Revision: 297059
URL: https://svnweb.freebsd.org/changeset/base/297059

Log:
  MFC r277759 (by jhb@)
  
  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.
  
  PR:           208136

Modified:
  stable/10/sys/dev/cxgbe/t4_main.c
  stable/10/sys/kern/subr_sglist.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/cxgbe/t4_main.c
==============================================================================
--- stable/10/sys/dev/cxgbe/t4_main.c   Sun Mar 20 03:54:57 2016        
(r297058)
+++ stable/10/sys/dev/cxgbe/t4_main.c   Sun Mar 20 05:01:40 2016        
(r297059)
@@ -3250,6 +3250,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: stable/10/sys/kern/subr_sglist.c
==============================================================================
--- stable/10/sys/kern/subr_sglist.c    Sun Mar 20 03:54:57 2016        
(r297058)
+++ stable/10/sys/kern/subr_sglist.c    Sun Mar 20 05:01:40 2016        
(r297059)
@@ -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-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to