diff options
author | Andrea Righi <andrea.righi@canonical.com> | 2020-07-24 10:59:10 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2020-07-24 17:02:01 -0700 |
commit | c2c633106453611be07821f53dff9e93a9d1c3f0 (patch) | |
tree | 8061aa72536c8acdca4d693a078a66129de423dd /kernel/compat.c | |
parent | c2b69f24ebd166a13cdc9909b50f33228895998b (diff) |
xen-netfront: fix potential deadlock in xennet_remove()
There's a potential race in xennet_remove(); this is what the driver is
doing upon unregistering a network device:
1. state = read bus state
2. if state is not "Closed":
3. request to set state to "Closing"
4. wait for state to be set to "Closing"
5. request to set state to "Closed"
6. wait for state to be set to "Closed"
If the state changes to "Closed" immediately after step 1 we are stuck
forever in step 4, because the state will never go back from "Closed" to
"Closing".
Make sure to check also for state == "Closed" in step 4 to prevent the
deadlock.
Also add a 5 sec timeout any time we wait for the bus state to change,
to avoid getting stuck forever in wait_event().
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'kernel/compat.c')
0 files changed, 0 insertions, 0 deletions