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)
commit2158e856f56bb762ef90f3ec244d41a519826f75
tree50eb78dea2a7df27e52f863b4c2a288ac4e54e9f
parent257c25598584f9f7aaccbcd7b9a6faf23aec3156
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