ravb: fix invalid context bug while calling auto-negotiation by ethtool
authorVladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Wed, 4 Jul 2018 08:14:50 +0000 (11:14 +0300)
committerDavid S. Miller <davem@davemloft.net>
Sat, 7 Jul 2018 01:44:09 +0000 (10:44 +0900)
Since commit 35b5f6b1a82b ("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: c156633f1353 ("Renesas Ethernet AVB driver proper")
Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
Reviewed-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/renesas/ravb_main.c

index 68f122140966d4de381b47fa192246eb7606707a..e7d6d1b6e7d6d8310f713cc2ac02c26bb63d8458 100644 (file)
@@ -1152,15 +1152,10 @@ error_exit:
 
 static int ravb_nway_reset(struct net_device *ndev)
 {
-       struct ravb_private *priv = netdev_priv(ndev);
        int error = -ENODEV;
-       unsigned long flags;
 
-       if (ndev->phydev) {
-               spin_lock_irqsave(&priv->lock, flags);
+       if (ndev->phydev)
                error = phy_start_aneg(ndev->phydev);
-               spin_unlock_irqrestore(&priv->lock, flags);
-       }
 
        return error;
 }