netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-2.6/stable] tg3: Restrict phy ioctl access
@ 2011-02-15 22:51 Matt Carlson
  2011-02-16 22:39 ` [stable] " Greg KH
  2011-02-17 22:11 ` David Miller
  0 siblings, 2 replies; 11+ messages in thread
From: Matt Carlson @ 2011-02-15 22:51 UTC (permalink / raw)
  To: davem; +Cc: netdev, mcarlson, stable

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.

Upstream commit ID f746a3136a61ae535c5d0b49a9418fa21edc61b5

Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
 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 93b32d3..06c0e503 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -11158,7 +11158,9 @@ static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 		if (tp->phy_flags & TG3_PHYFLG_PHY_SERDES)
 			break;			/* We have no PHY */
 
-		if (tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER)
+		if ((tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER) ||
+		    ((tp->tg3_flags & TG3_FLAG_ENABLE_ASF) &&
+		     !netif_running(dev)))
 			return -EAGAIN;
 
 		spin_lock_bh(&tp->lock);
@@ -11174,7 +11176,9 @@ static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 		if (tp->phy_flags & TG3_PHYFLG_PHY_SERDES)
 			break;			/* We have no PHY */
 
-		if (tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER)
+		if ((tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER) ||
+		    ((tp->tg3_flags & TG3_FLAG_ENABLE_ASF) &&
+		     !netif_running(dev)))
 			return -EAGAIN;
 
 		spin_lock_bh(&tp->lock);
-- 
1.7.3.4



^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2011-02-17 22:10 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-15 22:51 [PATCH net-2.6/stable] tg3: Restrict phy ioctl access Matt Carlson
2011-02-16 22:39 ` [stable] " Greg KH
2011-02-16 23:06   ` Matt Carlson
2011-02-16 23:11     ` David Miller
2011-02-16 23:52       ` Matt Carlson
2011-02-17  0:00         ` Greg KH
2011-02-17  0:11           ` Matt Carlson
2011-02-17  0:10         ` David Miller
2011-02-17  0:39           ` Matt Carlson
2011-02-17  0:56             ` David Miller
2011-02-17 22:11 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).