mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jia-Ju Bai <baijiaju1990@gmail.com>
To: simon.horman@corigine.com, Jakub Kicinski <kuba@kernel.org>,
	David Miller <davem@davemloft.net>,
	shenyang39@huawei.com, libaokun1@huawei.com
Cc: oss-drivers@corigine.com, netdev@vger.kernel.org,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: [BUG] net: netronome: nfp: possible deadlock in nfp_cpp_area_acquire() and nfp_cpp_area_release()
Date: Wed, 9 Feb 2022 10:50:44 +0800	[thread overview]
Message-ID: <922a002a-3ab6-eabe-131c-af3b8951866b@gmail.com> (raw)

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

             reply	other threads:[~2022-02-09  3:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-09  2:50 Jia-Ju Bai [this message]
2022-02-09  3:49 ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=922a002a-3ab6-eabe-131c-af3b8951866b@gmail.com \
    --to=baijiaju1990@gmail.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=libaokun1@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=oss-drivers@corigine.com \
    --cc=shenyang39@huawei.com \
    --cc=simon.horman@corigine.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®