LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [BUG] block: drbd: four possible ABBA deadlocks
@ 2021-08-19 9:31 Jia-Ju Bai
0 siblings, 0 replies; only message in thread
From: Jia-Ju Bai @ 2021-08-19 9:31 UTC (permalink / raw)
To: philipp.reisner, lars.ellenberg, Jens Axboe
Cc: drbd-dev, linux-block, linux-kernel
Hello,
My static analysis tool reports four possible ABBA deadlocks in the drbd
drivers in Linux 5.10:
### Deadlock A ###
w_after_conn_state_ch()
mutex_lock(&connection->resource->conf_update); --> line 2065
conn_free_crypto()
drbd_free_sock()
drbd_free_one_sock(&connection->data)
mutex_lock(&ds->mutex); --> line 2967
drbd_adm_net_opts()
mutex_lock(&connection->data.mutex); --> line 2445
mutex_lock(&connection->resource->conf_update); --> line 2446
When w_after_conn_state_ch() and drbd_adm_net_opts() are concurrently
executed, the deadlock can occur.
### Deadlock B ###
drbd_adm_connect()
mutex_lock(&adm_ctx.resource->conf_update); --> line 2644
conn_free_crypto()
drbd_free_one_sock(&connection->data)
mutex_lock(&ds->mutex); --> line 2967
drbd_adm_net_opts()
mutex_lock(&connection->data.mutex); --> line 2445
mutex_lock(&connection->resource->conf_update); --> line 2446
When drbd_adm_connect() and drbd_adm_net_opts() are concurrently
executed, the deadlock can occur.
### Deadlock C ###
w_after_conn_state_ch()
mutex_lock(&connection->resource->conf_update); --> line 2065
conn_free_crypto()
drbd_free_sock()
drbd_free_one_sock(&connection->data)
mutex_lock(&ds->mutex); --> line 2967
receive_protocol()
mutex_lock(&connection->data.mutex); --> line 3778
mutex_lock(&connection->resource->conf_update); --> line 3779
When w_after_conn_state_ch() and receive_protocol() are concurrently
executed, the deadlock can occur.
### Deadlock D ###
drbd_adm_connect()
mutex_lock(&adm_ctx.resource->conf_update); --> line 2644
conn_free_crypto()
drbd_free_one_sock(&connection->data)
mutex_lock(&ds->mutex); --> line 2967
receive_protocol()
mutex_lock(&connection->data.mutex); --> line 3778
mutex_lock(&connection->resource->conf_update); --> line 3779
When drbd_adm_connect() and receive_protocol() are concurrently
executed, the deadlock can occur.
I am not quite sure whether these possible deadlocks are real and how to
fix them if they are real.
Any feedback would be appreciated, thanks
Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Best wishes,
Jia-Ju Bai
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-08-19 9:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-19 9:31 [BUG] block: drbd: four possible ABBA deadlocks Jia-Ju Bai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).