From: Michael Chan Date: Tue, 8 May 2007 02:04:28 +0000 (-0700) Subject: [PATCH] BNX2: Block MII access when ifdown. X-Git-Tag: v2.6.21.2~44 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2a0167b2dbede7f06c970f36a7717da45f38181c;p=thirdparty%2Fkernel%2Fstable.git [PATCH] BNX2: Block MII access when ifdown. The device may be in D3hot state and should not allow MII register access. Signed-off-by: Michael Chan Signed-off-by: David S. Miller Signed-off-by: Chris Wright --- diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index d6d57a17f3fdb..81443ae6ea154 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c @@ -5564,6 +5564,9 @@ bnx2_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) case SIOCGMIIREG: { u32 mii_regval; + if (!netif_running(dev)) + return -EAGAIN; + spin_lock_bh(&bp->phy_lock); err = bnx2_read_phy(bp, data->reg_num & 0x1f, &mii_regval); spin_unlock_bh(&bp->phy_lock); @@ -5577,6 +5580,9 @@ bnx2_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) if (!capable(CAP_NET_ADMIN)) return -EPERM; + if (!netif_running(dev)) + return -EAGAIN; + spin_lock_bh(&bp->phy_lock); err = bnx2_write_phy(bp, data->reg_num & 0x1f, data->val_in); spin_unlock_bh(&bp->phy_lock);