aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancois Romieu <romieu@electric-eye.fr.zoreil.com>2005-11-30 16:32:13 -0500
committerFrancois Romieu <romieu@electric-eye.fr.zoreil.com>2005-11-30 16:32:13 -0500
commit3410572d519b6c68505f746f25033de97809eaa1 (patch)
tree5767b8a1108ecff31e5cf637eb8cdf5d7f020ae0
parentd9e2d185bf01e20339158f77c3fca00b02014912 (diff)
b44: early return in dev->do_ioctl when the device is not up
The device has not gone through a whole reset/init sequence until the device is up. Accessing the mii interface before this point is not safe. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
-rw-r--r--drivers/net/b44.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/net/b44.c b/drivers/net/b44.c
index c8d9b4d66704..e0ec777d96df 100644
--- a/drivers/net/b44.c
+++ b/drivers/net/b44.c
@@ -1838,12 +1838,15 @@ static int b44_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
1838{ 1838{
1839 struct mii_ioctl_data *data = if_mii(ifr); 1839 struct mii_ioctl_data *data = if_mii(ifr);
1840 struct b44 *bp = netdev_priv(dev); 1840 struct b44 *bp = netdev_priv(dev);
1841 int err; 1841 int err = -EINVAL;
1842
1843 if (!netif_running(dev))
1844 goto out;
1842 1845
1843 spin_lock_irq(&bp->lock); 1846 spin_lock_irq(&bp->lock);
1844 err = generic_mii_ioctl(&bp->mii_if, data, cmd, NULL); 1847 err = generic_mii_ioctl(&bp->mii_if, data, cmd, NULL);
1845 spin_unlock_irq(&bp->lock); 1848 spin_unlock_irq(&bp->lock);
1846 1849out:
1847 return err; 1850 return err;
1848} 1851}
1849 1852