svn commit: r322123 - head/sys/dev/cxgbe

Navdeep Parhar np at FreeBSD.org
Sun Aug 6 19:46:01 UTC 2017


Author: np
Date: Sun Aug  6 19:45:59 2017
New Revision: 322123
URL: https://svnweb.freebsd.org/changeset/base/322123

Log:
  cxgbe(4): Avoid a NULL dereference that would occur during module unload
  if there were problems earlier during attach.
  
  MFC after:	3 days
  Sponsored by:	Chelsio Communications

Modified:
  head/sys/dev/cxgbe/t4_sched.c

Modified: head/sys/dev/cxgbe/t4_sched.c
==============================================================================
--- head/sys/dev/cxgbe/t4_sched.c	Sun Aug  6 16:12:56 2017	(r322122)
+++ head/sys/dev/cxgbe/t4_sched.c	Sun Aug  6 19:45:59 2017	(r322123)
@@ -382,8 +382,10 @@ t4_free_tx_sched(struct adapter *sc)
 
 	taskqueue_drain(taskqueue_thread, &sc->tc_task);
 
-	for_each_port(sc, i)
-	    free(sc->port[i]->sched_params, M_CXGBE);
+	for_each_port(sc, i) {
+		if (sc->port[i] != NULL)
+			free(sc->port[i]->sched_params, M_CXGBE);
+	}
 
 	if (mtx_initialized(&sc->tc_lock))
 		mtx_destroy(&sc->tc_lock);


More information about the svn-src-all mailing list