mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [BUG] net: netronome: nfp: possible deadlock in nfp_cpp_area_acquire() and nfp_cpp_area_release()
@ 2022-02-09  2:50 Jia-Ju Bai
  2022-02-09  3:49 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: Jia-Ju Bai @ 2022-02-09  2:50 UTC (permalink / raw)
  To: simon.horman, Jakub Kicinski, David Miller, shenyang39, libaokun1
  Cc: oss-drivers, netdev, linux-kernel

Hello,

My static analysis tool reports a possible deadlock in the nfp driver in 
Linux 5.16:

nfp_cpp_area_acquire()
   mutex_lock(&area->mutex); --> Line 455 (Lock A)
   __nfp_cpp_area_acquire()
     wait_event_interruptible(area->cpp->waitq, ...) --> Line 427 (Wait X)

nfp_cpp_area_release()
   mutex_lock(&area->mutex); --> Line 502 (Lock A)
   wake_up_interruptible_all(&area->cpp->waitq); --> Line 508 (Wake X)

When nfp_cpp_area_acquire() is executed, "Wait X" is performed by 
holding "Lock A". If nfp_cpp_area_release() is executed at this time, 
"Wake X" cannot be performed to wake up "Wait X" in 
nfp_cpp_area_acquire(), because "Lock A" has been already hold by 
nfp_cpp_area_acquire(), 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] 2+ messages in thread

end of thread, other threads:[~2022-02-09  4:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-09  2:50 [BUG] net: netronome: nfp: possible deadlock in nfp_cpp_area_acquire() and nfp_cpp_area_release() Jia-Ju Bai
2022-02-09  3:49 ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®