From: Jia-Ju Bai <baijiaju1990@gmail.com>
To: pontus.fuchs@gmail.com, Kalle Valo <kvalo@codeaurora.org>
Cc: linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: [BUG] ar5523: possible deadlocks involving locking and waiting operations
Date: Tue, 8 Feb 2022 19:13:15 +0800 [thread overview]
Message-ID: <7c9bb278-5042-3bdc-9598-95a10e42f78d@gmail.com> (raw)
Hello,
My static analysis tool reports two possible deadlocks in the ar5523
driver in Linux 5.16:
#BUG 1
ar5523_hwconfig()
mutex_lock(&ar->mutex); --> Line 1135 (Lock A)
ar5523_flush_tx()
wait_event_timeout(ar->tx_flush_waitq, ...) --> Line 926 (Wait X)
ar5523_tx_work()
mutex_lock(&ar->mutex); --> Line 888 (Lock A)
ar5523_tx_work_locked()
ar5523_data_tx_pkt_put()
wake_up(&ar->tx_flush_waitq); --> Line 727 (Wake X)
#BUG 2
ar5523_configure_filter()
mutex_lock(&ar->mutex); --> Line 1331 (Lock A)
ar5523_flush_tx()
wait_event_timeout(ar->tx_flush_waitq, ...) --> Line 926 (Wait X)
ar5523_tx_work()
mutex_lock(&ar->mutex); --> Line 888 (Lock A)
ar5523_tx_work_locked()
ar5523_data_tx_pkt_put()
wake_up(&ar->tx_flush_waitq); --> Line 727 (Wake X)
When ar5523_hwconfig()/ar5523_configure_filter() is executed, "Wait X"
is performed by holding "Lock A". If ar5523_tx_work() is executed at
this time, "Wake X" cannot be performed to wake up "Wait X", because
"Lock A" has been already held, causing possible deadlock.
I find that "Wait X" is performed with a timeout, to relieve the
possible deadlocks; but I think this timeout can cause inefficient
execution.
I am not quite sure whether these possible problems are real.
Any feedback would be appreciated, thanks :)
Best wishes,
Jia-Ju Bai
reply other threads:[~2022-02-08 11:35 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=7c9bb278-5042-3bdc-9598-95a10e42f78d@gmail.com \
--to=baijiaju1990@gmail.com \
--cc=kvalo@codeaurora.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pontus.fuchs@gmail.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®