]> git.baikalelectronics.ru Git - kernel.git/commit
net: phy: add locking to phy_read_mmd_indirect()/phy_write_mmd_indirect()
authorRussell King <rmk+kernel@arm.linux.org.uk>
Tue, 25 Aug 2015 08:49:47 +0000 (09:49 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 25 Aug 2015 23:30:46 +0000 (16:30 -0700)
commit1f07f33ed439af3551fa8757058f0d8d51d3dff9
treed43da7ed68308ae9b606d7ad681f5789c1956acd
parentf154f448ae2e9d9b8c1b9e2f5877c18d5c544625
net: phy: add locking to phy_read_mmd_indirect()/phy_write_mmd_indirect()

The phy layer is missing locking for the above two functions - it
has been observed that two threads (userspace and the phy worker
thread) can race, entering the bus ->write or ->read functions
simultaneously.

This causes the FEC driver to initialise a completion while another
thread is waiting on it or while the interrupt is calling complete()
on it, which causes spinlock unlock-without-lock, spinlock lockups,
and completion timeouts.

Fixes: bc70a6254 ("phy: add the EEE support and the way to access to the MMD registers.")
Fixes: b1b28a182 ("net: libphy: Add phy specific function to access mmd phy registers")
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/phy.c