summaryrefslogtreecommitdiff
path: root/net/hsr
diff options
context:
space:
mode:
authorSukadev Bhattiprolu <sukadev@linux.ibm.com>2021-02-23 21:02:29 -0800
committerJakub Kicinski <kuba@kernel.org>2021-02-24 16:13:30 -0800
commit8f1c0fd2c84c8bf738b7139d09d4ea53027f47c3 (patch)
tree7fc3bf89224088979b76086327b112dd00939083 /net/hsr
parent17d7fd47aa9063c2ff36988e36757ac345733e28 (diff)
downloadlwn-8f1c0fd2c84c8bf738b7139d09d4ea53027f47c3.tar.gz
lwn-8f1c0fd2c84c8bf738b7139d09d4ea53027f47c3.zip
ibmvnic: fix a race between open and reset
__ibmvnic_reset() currently reads the adapter->state before getting the rtnl and saves that state as the "target state" for the reset. If this read occurs when adapter is in PROBED state, the target state would be PROBED. Just after the target state is saved, and before the actual reset process is started (i.e before rtnl is acquired) if we get an ibmvnic_open() call we would move the adapter to OPEN state. But when the reset is processed (after ibmvnic_open()) drops the rtnl), it will leave the adapter in PROBED state even though we already moved it to OPEN. To fix this, use the RTNL to improve serialization when reading/updating the adapter state. i.e determine the target state of a reset only after getting the RTNL. And if a reset is in progress during an open, simply set the target state of the adapter and let the reset code finish the open (like we currently do if failover is pending). One twist to this serialization is if the adapter state changes when we drop the RTNL to update the link state. Account for this by checking if there was an intervening open and update the target state for the reset accordingly (see new comments in the code). Note that only the reset functions and ibmvnic_open() can set the adapter to OPEN state and this must happen under rtnl. Fixes: 7d7195a026ba ("ibmvnic: Do not process device remove during device reset") Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.ibm.com> Reviewed-by: Dany Madden <drt@linux.ibm.com> Link: https://lore.kernel.org/r/20210224050229.1155468-1-sukadev@linux.ibm.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/hsr')
0 files changed, 0 insertions, 0 deletions