aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Chan <mchan@broadcom.com>2007-05-03 16:18:03 -0400
committerDavid S. Miller <davem@davemloft.net>2007-05-03 16:18:03 -0400
commitdad3e452dacd3c6c637e2f7c6469556cc8ffcd94 (patch)
treee4f15a518dceae672d4730518f92153dbcd66ffe
parent427c2196b92697a4a8ee87959ebc16bfac024f6b (diff)
[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 <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/bnx2.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index f98a2205a090..9f0a06722e23 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -5562,6 +5562,9 @@ bnx2_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
5562 case SIOCGMIIREG: { 5562 case SIOCGMIIREG: {
5563 u32 mii_regval; 5563 u32 mii_regval;
5564 5564
5565 if (!netif_running(dev))
5566 return -EAGAIN;
5567
5565 spin_lock_bh(&bp->phy_lock); 5568 spin_lock_bh(&bp->phy_lock);
5566 err = bnx2_read_phy(bp, data->reg_num & 0x1f, &mii_regval); 5569 err = bnx2_read_phy(bp, data->reg_num & 0x1f, &mii_regval);
5567 spin_unlock_bh(&bp->phy_lock); 5570 spin_unlock_bh(&bp->phy_lock);
@@ -5575,6 +5578,9 @@ bnx2_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
5575 if (!capable(CAP_NET_ADMIN)) 5578 if (!capable(CAP_NET_ADMIN))
5576 return -EPERM; 5579 return -EPERM;
5577 5580
5581 if (!netif_running(dev))
5582 return -EAGAIN;
5583
5578 spin_lock_bh(&bp->phy_lock); 5584 spin_lock_bh(&bp->phy_lock);
5579 err = bnx2_write_phy(bp, data->reg_num & 0x1f, data->val_in); 5585 err = bnx2_write_phy(bp, data->reg_num & 0x1f, data->val_in);
5580 spin_unlock_bh(&bp->phy_lock); 5586 spin_unlock_bh(&bp->phy_lock);