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
This commit is contained in:
hselasky 2016-03-15 15:47:26 +00:00
parent 3d336a82bd
commit 659fbd3907
2 changed files with 7 additions and 0 deletions

View File

@ -322,6 +322,8 @@ struct ipoib_dev_priv {
unsigned long flags;
int gone;
struct mutex vlan_mutex;
struct rb_root path_tree;

View File

@ -258,6 +258,10 @@ ipoib_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
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);