diff options
author | Matt Carlson <mcarlson@broadcom.com> | 2011-01-25 10:58:51 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-01-25 22:38:17 -0500 |
commit | f746a3136a61ae535c5d0b49a9418fa21edc61b5 (patch) | |
tree | a59083f33ea74ccf3df7f1dd4468ec06d39dc997 | |
parent | 0583d52114b19ea06d03dd2cf762a7737c265400 (diff) |
tg3: Restrict phy ioctl access
If management firmware is present and the device is down, the firmware
will assume control of the phy. If a phy access were allowed from the
host, it will collide with firmware phy accesses, resulting in
unpredictable behavior. This patch fixes the problem by disallowing phy
accesses during the problematic condition.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/tg3.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index b2a16b4e3caf..370c67a9d08a 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -11165,7 +11165,9 @@ static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
11165 | if (tp->phy_flags & TG3_PHYFLG_PHY_SERDES) | 11165 | if (tp->phy_flags & TG3_PHYFLG_PHY_SERDES) |
11166 | break; /* We have no PHY */ | 11166 | break; /* We have no PHY */ |
11167 | 11167 | ||
11168 | if (tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER) | 11168 | if ((tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER) || |
11169 | ((tp->tg3_flags & TG3_FLAG_ENABLE_ASF) && | ||
11170 | !netif_running(dev))) | ||
11169 | return -EAGAIN; | 11171 | return -EAGAIN; |
11170 | 11172 | ||
11171 | spin_lock_bh(&tp->lock); | 11173 | spin_lock_bh(&tp->lock); |
@@ -11181,7 +11183,9 @@ static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
11181 | if (tp->phy_flags & TG3_PHYFLG_PHY_SERDES) | 11183 | if (tp->phy_flags & TG3_PHYFLG_PHY_SERDES) |
11182 | break; /* We have no PHY */ | 11184 | break; /* We have no PHY */ |
11183 | 11185 | ||
11184 | if (tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER) | 11186 | if ((tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER) || |
11187 | ((tp->tg3_flags & TG3_FLAG_ENABLE_ASF) && | ||
11188 | !netif_running(dev))) | ||
11185 | return -EAGAIN; | 11189 | return -EAGAIN; |
11186 | 11190 | ||
11187 | spin_lock_bh(&tp->lock); | 11191 | spin_lock_bh(&tp->lock); |