Author: hselasky
Date: Thu Apr  7 07:31:17 2016
New Revision: 297649
URL: https://svnweb.freebsd.org/changeset/base/297649

Log:
  MFC r296909:
  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

Modified:
  stable/9/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h
  stable/9/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h
==============================================================================
--- stable/9/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h      Thu Apr  7 
07:29:57 2016        (r297648)
+++ stable/9/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h      Thu Apr  7 
07:31:17 2016        (r297649)
@@ -319,6 +319,8 @@ struct ipoib_dev_priv {
 
        unsigned long flags;
 
+       int gone;
+
        struct mutex vlan_mutex;
 
        struct rb_root  path_tree;

Modified: stable/9/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c
==============================================================================
--- stable/9/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Thu Apr  7 
07:29:57 2016        (r297648)
+++ stable/9/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c Thu Apr  7 
07:31:17 2016        (r297649)
@@ -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);
_______________________________________________
svn-src-stable-9@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-9
To unsubscribe, send any mail to "svn-src-stable-9-unsubscr...@freebsd.org"

Reply via email to