Skip to content

Commit ed199fa

Browse files
Matt Carlsondavem330
authored andcommitted
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>
1 parent 0d672e9 commit ed199fa

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/net/tg3.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11158,7 +11158,9 @@ static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
1115811158
if (tp->phy_flags & TG3_PHYFLG_PHY_SERDES)
1115911159
break; /* We have no PHY */
1116011160

11161-
if (tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER)
11161+
if ((tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER) ||
11162+
((tp->tg3_flags & TG3_FLAG_ENABLE_ASF) &&
11163+
!netif_running(dev)))
1116211164
return -EAGAIN;
1116311165

1116411166
spin_lock_bh(&tp->lock);
@@ -11174,7 +11176,9 @@ static int tg3_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
1117411176
if (tp->phy_flags & TG3_PHYFLG_PHY_SERDES)
1117511177
break; /* We have no PHY */
1117611178

11177-
if (tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER)
11179+
if ((tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER) ||
11180+
((tp->tg3_flags & TG3_FLAG_ENABLE_ASF) &&
11181+
!netif_running(dev)))
1117811182
return -EAGAIN;
1117911183

1118011184
spin_lock_bh(&tp->lock);

0 commit comments

Comments
 (0)