IB/IPoIB: Fix race between ipoib_remove_one to sysfs functions
[cascardo/linux.git] / drivers / infiniband / ulp / ipoib / ipoib_main.c
index 2d7c163..0aa52c2 100644 (file)
@@ -2141,6 +2141,9 @@ static void ipoib_remove_one(struct ib_device *device, void *client_data)
                ib_unregister_event_handler(&priv->event_handler);
                flush_workqueue(ipoib_workqueue);
 
+               /* mark interface in the middle of destruction */
+               set_bit(IPOIB_FLAG_GOING_DOWN, &priv->flags);
+
                rtnl_lock();
                dev_change_flags(priv->dev, priv->dev->flags & ~IFF_UP);
                rtnl_unlock();