Commit f0163ac4 authored by Jesse Brandeburg's avatar Jesse Brandeburg Committed by David S. Miller

[E1000]: Fix schedule while atomic when called from mii-tool.

mii-tool can cause the driver to call msleep during nway reset,
bugzilla.kernel.org bug 8430.  Fix by simply calling reinit_locked
outside of the spinlock, which is safe from ethtool, so it should be
safe from here.
Signed-off-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: default avatarAuke Kok <auke-jan.h.kok@intel.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e2ac455a
...@@ -4804,6 +4804,7 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) ...@@ -4804,6 +4804,7 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
spin_unlock_irqrestore(&adapter->stats_lock, flags); spin_unlock_irqrestore(&adapter->stats_lock, flags);
return -EIO; return -EIO;
} }
spin_unlock_irqrestore(&adapter->stats_lock, flags);
if (adapter->hw.media_type == e1000_media_type_copper) { if (adapter->hw.media_type == e1000_media_type_copper) {
switch (data->reg_num) { switch (data->reg_num) {
case PHY_CTRL: case PHY_CTRL:
...@@ -4824,13 +4825,9 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) ...@@ -4824,13 +4825,9 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
DUPLEX_HALF; DUPLEX_HALF;
retval = e1000_set_spd_dplx(adapter, retval = e1000_set_spd_dplx(adapter,
spddplx); spddplx);
if (retval) { if (retval)
spin_unlock_irqrestore(
&adapter->stats_lock,
flags);
return retval; return retval;
} }
}
if (netif_running(adapter->netdev)) if (netif_running(adapter->netdev))
e1000_reinit_locked(adapter); e1000_reinit_locked(adapter);
else else
...@@ -4838,11 +4835,8 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) ...@@ -4838,11 +4835,8 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
break; break;
case M88E1000_PHY_SPEC_CTRL: case M88E1000_PHY_SPEC_CTRL:
case M88E1000_EXT_PHY_SPEC_CTRL: case M88E1000_EXT_PHY_SPEC_CTRL:
if (e1000_phy_reset(&adapter->hw)) { if (e1000_phy_reset(&adapter->hw))
spin_unlock_irqrestore(
&adapter->stats_lock, flags);
return -EIO; return -EIO;
}
break; break;
} }
} else { } else {
...@@ -4857,7 +4851,6 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd) ...@@ -4857,7 +4851,6 @@ e1000_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
break; break;
} }
} }
spin_unlock_irqrestore(&adapter->stats_lock, flags);
break; break;
default: default:
return -EOPNOTSUPP; return -EOPNOTSUPP;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment