]> git.baikalelectronics.ru Git - kernel.git/commit
net: sfp: add mutex to prevent concurrent state checks
authorRobert Hancock <hancock@sedsystems.ca>
Fri, 7 Jun 2019 16:42:36 +0000 (10:42 -0600)
committerDavid S. Miller <davem@davemloft.net>
Mon, 10 Jun 2019 02:25:59 +0000 (19:25 -0700)
commitca60260e89a35f2d1196cfb2bde878193b86a5c4
tree50eb78dea2a7df27e52f863b4c2a288ac4e54e9f
parent2f3d5e0ceaa5be51ff588c9031dfa2d360358d7a
net: sfp: add mutex to prevent concurrent state checks

sfp_check_state can potentially be called by both a threaded IRQ handler
and delayed work. If it is concurrently called, it could result in
incorrect state management. Add a st_mutex to protect the state - this
lock gets taken outside of code that checks and handle state changes, and
the existing sm_mutex nests inside of it.

Suggested-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Robert Hancock <hancock@sedsystems.ca>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/sfp.c