[<prev] [next>] [day] [month] [year] [list]
Message-ID: <6f489bf2-bac0-8030-7ea5-6f5c12daa568@gmail.com>
Date: Tue, 1 Feb 2022 15:09:34 +0800
From: Jia-Ju Bai <baijiaju1990@...il.com>
To: jerome.pouiller@...abs.com, Greg KH <gregkh@...uxfoundation.org>
Cc: linux-staging@...ts.linux.dev,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: [BUG] staging: wfx: possible deadlock in wfx_conf_tx() and
wfx_add_interface()
Hello,
My static analysis tool reports a possible deadlock in the wfx driver in
Linux 5.16:
wfx_conf_tx()
mutex_lock(&wdev->conf_mutex); --> Line 225 (Lock A)
wfx_update_pm()
wait_for_completion_timeout(&wvif->set_pm_mode_complete, ...); -->
Line 3019 (Wait X)
wfx_add_interface()
mutex_lock(&wdev->conf_mutex); --> Line 737 (Lock A)
complete(&wvif->set_pm_mode_complete); --> Line 758 (Wake X)
When wfx_conf_tx() is executed, "Wait X" is performed by holding "Lock
A". If wfx_add_interface() is executed at this time, "Wake X" cannot be
performed to wake up "Wait X" in wfx_conf_tx(), because "Lock A" has
been already hold by wfx_conf_tx(), causing a possible deadlock.
I find that "Wait X" is performed with a timeout, to relieve the
possible deadlock; but I think this timeout can cause inefficient execution.
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
Powered by blists - more mailing lists