netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUG] net: smc: possible deadlock in smc_lgr_free() and smc_link_down_work()
@ 2022-02-01  7:51 Jia-Ju Bai
  2022-02-01 10:53 ` Karsten Graul
  2022-02-01 17:06 ` Karsten Graul
  0 siblings, 2 replies; 5+ messages in thread
From: Jia-Ju Bai @ 2022-02-01  7:51 UTC (permalink / raw)
  To: kgraul, davem, kuba; +Cc: linux-s390, netdev, linux-kernel

Hello,

My static analysis tool reports a possible deadlock in the smc module in 
Linux 5.16:

smc_lgr_free()
   mutex_lock(&lgr->llc_conf_mutex); --> Line 1289 (Lock A)
   smcr_link_clear()
     smc_wr_free_link()
       wait_event(lnk->wr_tx_wait, ...); --> Line 648 (Wait X)

smc_link_down_work()
   mutex_lock(&lgr->llc_conf_mutex); --> Line 1683 (Lock A)
   smcr_link_down()
     smcr_link_clear()
       smc_wr_free_link()
         smc_wr_wakeup_tx_wait()
           wake_up_all(&lnk->wr_tx_wait); --> Line 78 (Wake X)

When smc_lgr_free() is executed, "Wait X" is performed by holding "Lock 
A". If smc_link_down_work() is executed at this time, "Wake X" cannot be 
performed to wake up "Wait X" in smc_lgr_free(), because "Lock A" has 
been already hold by smc_lgr_free(), causing a possible deadlock.

I am not quite sure whether this possible problem is real and how to fix 
it if it is real.
Any feedback would be appreciated, thanks :)


Best wishes,
Jia-Ju Bai

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-02-08 17:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-01  7:51 [BUG] net: smc: possible deadlock in smc_lgr_free() and smc_link_down_work() Jia-Ju Bai
2022-02-01 10:53 ` Karsten Graul
2022-02-01 17:06 ` Karsten Graul
2022-02-06 15:09   ` Jia-Ju Bai
2022-02-08 17:22     ` Karsten Graul

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).