svn commit: r296909 - head/sys/ofed/drivers/infiniband/ulp/ipoib

Hans Petter Selasky hselasky at FreeBSD.org
Tue Mar 15 15:47:27 UTC 2016


Author: hselasky
Date: Tue Mar 15 15:47:26 2016
New Revision: 296909
URL: https://svnweb.freebsd.org/changeset/base/296909

Log:
  Fix witness panic in the ipoib_ioctl() function when unloading the
  ipoib module.
  
  The bpfdetach() function is trying to turn off promiscious mode on the
  network interface it is attached to while holding a mutex. The fix
  consists of ignoring any further calls to the ipoib_ioctl() function
  when the network interface is going to be detached. The ipoib_ioctl()
  function might sleep.
  
  Sponsored by:	Mellanox Technologies
  MFC after:	1 week

Modified:
  head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h
  head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c

Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h
==============================================================================
--- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h	Tue Mar 15 15:42:53 2016	(r296908)
+++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h	Tue Mar 15 15:47:26 2016	(r296909)
@@ -322,6 +322,8 @@ struct ipoib_dev_priv {
 
 	unsigned long flags;
 
+	int gone;
+
 	struct mutex vlan_mutex;
 
 	struct rb_root  path_tree;

Modified: head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c
==============================================================================
--- head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c	Tue Mar 15 15:42:53 2016	(r296908)
+++ head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c	Tue Mar 15 15:47:26 2016	(r296909)
@@ -258,6 +258,10 @@ ipoib_ioctl(struct ifnet *ifp, u_long co
 	struct ifreq *ifr = (struct ifreq *) data;
 	int error = 0;
 
+	/* check if detaching */
+	if (priv == NULL || priv->gone != 0)
+		return (ENXIO);
+
 	switch (command) {
 	case SIOCSIFFLAGS:
 		if (ifp->if_flags & IFF_UP) {
@@ -794,6 +798,7 @@ ipoib_detach(struct ipoib_dev_priv *priv
 
 	dev = priv->dev;
 	if (!test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) {
+		priv->gone = 1;
 		bpfdetach(dev);
 		if_detach(dev);
 		if_free(dev);


More information about the svn-src-all mailing list