lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 17 Nov 2011 08:58:01 +0100
From:	Giuseppe CAVALLARO <>
	Giuseppe Cavallaro <>
Subject: [PATCH 4/5] stmmac: remove spin_lock in stmmac_ioctl.

From: Srinivas Kandagatla <>

This patch removes un-needed spin_lock in stmmac_ioctl while reading and
writing mdio registers. While holding spin_lock the code must be
atomic, which is not true in this case as both mdiobus_read and writes
have mutex locks.

Without this patch reading mdio registers via mii-tool results in below
mii-tool -vvv eth0"
Using SIOCGMIIPHY=0x8947
BUG: sleeping function called from invalid context at kernel/mutex.c:287
in_atomic(): 1, irqs_disabled(): 0, pid: 614, name: mii-tool
2 locks held by mii-tool/614:
 #0:  (rtnl_mutex){......}, at: [<c01fd80c>] dev_ioctl+0x550/0x674
 #1:  (&priv->lock){......}, at: [<c01b34ec>] stmmac_ioctl+0x4c/0x78
[<c002ea14>] (unwind_backtrace+0x0/0xcc) from [<c0272c38>]
[<c0272c38>] (mutex_lock_nested+0x24/0x35c) from [<c01b237c>]
[<c01b237c>] (mdiobus_read+0x44/0x70) from [<c01b0c64>]
[<c01b0c64>] (phy_mii_ioctl+0x4c/0x138) from [<c01b34fc>]
[<c01b34fc>] (stmmac_ioctl+0x5c/0x78) from [<c01fcec8>]
[<c01fcec8>] (dev_ifsioc+0x2a4/0x2c8) from [<c01fd81c>]
[<c01fd81c>] (dev_ioctl+0x560/0x674) from [<c00c36e0>]
[<c00c36e0>] (vfs_ioctl+0x2c/0x8c) from [<c00c4130>]
[<c00c4130>] (do_vfs_ioctl+0x530/0x578) from [<c00c41ac>]
[<c00c41ac>] (sys_ioctl+0x34/0x54) from [<c0028aa0>]

Signed-off-by: Srinivas Kandagatla <>
Signed-off-by: Giuseppe Cavallaro <>
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 7f3ffd3..29dd87c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1536,9 +1536,7 @@ static int stmmac_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 	if (!priv->phydev)
 		return -EINVAL;
-	spin_lock(&priv->lock);
 	ret = phy_mii_ioctl(priv->phydev, rq, cmd);
-	spin_unlock(&priv->lock);
 	return ret;

To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to
More majordomo info at

Powered by blists - more mailing lists