]> err.no Git - linux-2.6/commitdiff
b44: early return in dev->do_ioctl when the device is not up
authorFrancois Romieu <romieu@electric-eye.fr.zoreil.com>
Wed, 30 Nov 2005 21:32:13 +0000 (22:32 +0100)
committerFrancois Romieu <romieu@electric-eye.fr.zoreil.com>
Wed, 30 Nov 2005 21:32:13 +0000 (22:32 +0100)
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>
drivers/net/b44.c

index c8d9b4d667041ff85991e1b0ba77c9cf548ab76e..e0ec777d96dfda911f501a4f2cb6bd04e8d69998 100644 (file)
@@ -1838,12 +1838,15 @@ static int b44_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 {
        struct mii_ioctl_data *data = if_mii(ifr);
        struct b44 *bp = netdev_priv(dev);
-       int err;
+       int err = -EINVAL;
+
+       if (!netif_running(dev))
+               goto out;
 
        spin_lock_irq(&bp->lock);
        err = generic_mii_ioctl(&bp->mii_if, data, cmd, NULL);
        spin_unlock_irq(&bp->lock);
-
+out:
        return err;
 }