svn commit: r335957 - head/sys/dev/mxge

Andrew Gallatin gallatin at FreeBSD.org
Wed Jul 4 14:25:39 UTC 2018


Author: gallatin
Date: Wed Jul  4 14:25:38 2018
New Revision: 335957
URL: https://svnweb.freebsd.org/changeset/base/335957

Log:
  mxge: fix panic at module unload
  
  r333175 (multicast changes) exposed a bug where
  mxge was not checking to see if the driver was being
  unloaded while handing ioctls that touch hardware.
  As a result, now that in6m_disconnect() is run from
  an async gtaskq, it was busy-waiting in mxge_send_cmd()
  while the mcast list was destroyed.

Modified:
  head/sys/dev/mxge/if_mxge.c

Modified: head/sys/dev/mxge/if_mxge.c
==============================================================================
--- head/sys/dev/mxge/if_mxge.c	Wed Jul  4 14:20:19 2018	(r335956)
+++ head/sys/dev/mxge/if_mxge.c	Wed Jul  4 14:25:38 2018	(r335957)
@@ -4193,6 +4193,10 @@ mxge_ioctl(struct ifnet *ifp, u_long command, caddr_t 
 	case SIOCADDMULTI:
 	case SIOCDELMULTI:
 		mtx_lock(&sc->driver_mtx);
+		if (sc->dying) {
+			mtx_unlock(&sc->driver_mtx);
+			return (EINVAL);
+		}
 		mxge_set_multicast_list(sc);
 		mtx_unlock(&sc->driver_mtx);
 		break;
@@ -4278,6 +4282,10 @@ mxge_ioctl(struct ifnet *ifp, u_long command, caddr_t 
 
 	case SIOCGIFMEDIA:
 		mtx_lock(&sc->driver_mtx);
+		if (sc->dying) {
+			mtx_unlock(&sc->driver_mtx);
+			return (EINVAL);
+		}
 		mxge_media_probe(sc);
 		mtx_unlock(&sc->driver_mtx);
 		err = ifmedia_ioctl(ifp, (struct ifreq *)data,


More information about the svn-src-all mailing list