* [BUG] scsi: qedi: possible ABBA deadlock in qedi_process_tmf_resp() and qedi_process_cmd_cleanup_resp()
@ 2022-02-08 11:23 Jia-Ju Bai
2022-02-08 17:10 ` Mike Christie
0 siblings, 1 reply; 2+ messages in thread
From: Jia-Ju Bai @ 2022-02-08 11:23 UTC (permalink / raw)
To: njavali, mrangankar, GR-QLogic-Storage-Upstream, jejb,
martin.petersen
Cc: linux-scsi, linux-kernel
Hello,
My static analysis tool reports a possible ABBA deadlock in the qedi
driver in Linux 5.16:
qedi_process_tmf_resp()
spin_lock(&session->back_lock); --> Line 201 (Lock A)
spin_lock(&qedi_conn->tmf_work_lock); --> Line 230 (Lock B)
qedi_process_cmd_cleanup_resp()
spin_lock_bh(&qedi_conn->tmf_work_lock); --> Line 752 (Lock B)
spin_lock_bh(&conn->session->back_lock); --> Line 784 (Lock A)
When qedi_process_tmf_resp() and qedi_process_cmd_cleanup_resp() are
concurrently executed, the deadlock can occur.
I am not quite sure whether this possible deadlock is real and how to
fix it if it is 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] 2+ messages in thread
* Re: [BUG] scsi: qedi: possible ABBA deadlock in qedi_process_tmf_resp() and qedi_process_cmd_cleanup_resp()
2022-02-08 11:23 [BUG] scsi: qedi: possible ABBA deadlock in qedi_process_tmf_resp() and qedi_process_cmd_cleanup_resp() Jia-Ju Bai
@ 2022-02-08 17:10 ` Mike Christie
0 siblings, 0 replies; 2+ messages in thread
From: Mike Christie @ 2022-02-08 17:10 UTC (permalink / raw)
To: Jia-Ju Bai, njavali, mrangankar, GR-QLogic-Storage-Upstream, jejb,
martin.petersen
Cc: linux-scsi, linux-kernel
On 2/8/22 5:23 AM, Jia-Ju Bai wrote:
> Hello,
>
> My static analysis tool reports a possible ABBA deadlock in the qedi driver in Linux 5.16:
>
> qedi_process_tmf_resp()
> spin_lock(&session->back_lock); --> Line 201 (Lock A)
> spin_lock(&qedi_conn->tmf_work_lock); --> Line 230 (Lock B)
>
> qedi_process_cmd_cleanup_resp()
> spin_lock_bh(&qedi_conn->tmf_work_lock); --> Line 752 (Lock B)
> spin_lock_bh(&conn->session->back_lock); --> Line 784 (Lock A)
>
> When qedi_process_tmf_resp() and qedi_process_cmd_cleanup_resp() are concurrently executed, the deadlock can occur.
>
> I am not quite sure whether this possible deadlock is real and how to fix it if it is real.
> Any feedback would be appreciated, thanks :)
>
That looks like a valid deadlock. I'll send a patch. Thanks.
> Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
>
>
> Best wishes,
> Jia-Ju Bai
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-02-08 17:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-08 11:23 [BUG] scsi: qedi: possible ABBA deadlock in qedi_process_tmf_resp() and qedi_process_cmd_cleanup_resp() Jia-Ju Bai
2022-02-08 17:10 ` Mike Christie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox