Commit 53a710b5 authored by Vladimir Zapolskiy's avatar Vladimir Zapolskiy Committed by David S. Miller

sh_eth: fix invalid context bug while calling auto-negotiation by ethtool

Since commit 35b5f6b1 ("PHYLIB: Locking fixes for PHY I/O
potentially sleeping") phy_start_aneg() function utilizes a mutex
to serialize changes to phy state, however the helper function is
called in atomic context.

The bug can be reproduced by running "ethtool -r" command, the bug
is reported if CONFIG_DEBUG_ATOMIC_SLEEP build option is enabled.

Fixes: dc19e4e5 ("sh: sh_eth: Add support ethtool")
Signed-off-by: default avatarVladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Reviewed-by: default avatarSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 70ba5b6d
...@@ -2265,18 +2265,10 @@ static void sh_eth_get_regs(struct net_device *ndev, struct ethtool_regs *regs, ...@@ -2265,18 +2265,10 @@ static void sh_eth_get_regs(struct net_device *ndev, struct ethtool_regs *regs,
static int sh_eth_nway_reset(struct net_device *ndev) static int sh_eth_nway_reset(struct net_device *ndev)
{ {
struct sh_eth_private *mdp = netdev_priv(ndev);
unsigned long flags;
int ret;
if (!ndev->phydev) if (!ndev->phydev)
return -ENODEV; return -ENODEV;
spin_lock_irqsave(&mdp->lock, flags); return phy_start_aneg(ndev->phydev);
ret = phy_start_aneg(ndev->phydev);
spin_unlock_irqrestore(&mdp->lock, flags);
return ret;
} }
static u32 sh_eth_get_msglevel(struct net_device *ndev) static u32 sh_eth_get_msglevel(struct net_device *ndev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment