From: Phillip Potter <phil@philpotter.co.uk>
To: Gui-Dong Han <hanguidong02@gmail.com>
Cc: phil@philpotter.co.uk, paskripkin@gmail.com,
Greg KH <gregkh@linuxfoundation.org>,
linux-staging@lists.linux.dev,
LKML <linux-kernel@vger.kernel.org>,
baijiaju1990@gmail.com, stable@vger.kernel.org
Subject: Re: [BUG] r8188eu: Potential deadlocks in rtw_wx_set_wap/essid functions
Date: Tue, 25 Feb 2025 13:57:05 +0000 [thread overview]
Message-ID: <Z73MMWEI7o59qzDL@equinox> (raw)
In-Reply-To: <CAOPYjvaOBke7QVqAwbxOGyuVVb2hQGi3t-yiN7P=4sK-Mt-+Dg@mail.gmail.com>
On Tue, Feb 25, 2025 at 09:02:00PM +0800, Gui-Dong Han wrote:
> Hello maintainers,
>
> I would like to report a potential lock ordering issue in the r8188eu
> driver. This may lead to deadlocks under certain conditions.
>
> The functions rtw_wx_set_wap() and rtw_wx_set_essid() acquire locks in
> an order that contradicts the established locking hierarchy observed
> in other parts of the driver:
>
> 1. They first take &pmlmepriv->scanned_queue.lock
> 2. Then call rtw_set_802_11_infrastructure_mode() which takes &pmlmepriv->lock
>
> This is inverted compared to the common pattern seen in functions like
> rtw_joinbss_event_prehandle(), rtw_createbss_cmd_callback(), and
> others, which typically:
>
> 1. Take &pmlmepriv->lock first
> 2. Then take &pmlmepriv->scanned_queue.lock
>
> This lock inversion creates a potential deadlock scenario when these
> code paths execute concurrently.
>
> Moreover, the call chain: rtw_wx_set_* ->
> rtw_set_802_11_infrastructure_mode() -> rtw_free_assoc_resources()
> could lead to recursive acquisition of &pmlmepriv->scanned_queue.lock,
> potentially causing self-deadlock even without concurrency.
>
> This issue exists in longterm kernels containing the r8188eu driver:
>
> 5.4.y (until 5.4.290)
> 5.10.y (until 5.10.234)
> 5.15.y (until 5.15.178)
> 6.1.y (until 6.1.129)
>
> The r8188eu driver has been removed from upstream, but older
> maintained versions (5.4.x–6.1.x) still include this driver and are
> affected.
>
> This issue was identified through static analysis. While I've verified
> the locking patterns through code review, I'm not sufficiently
> familiar with the driver's internals to propose a safe fix.
>
> Thank you for your attention to this matter.
>
> Best regards,
> Gui-Dong Han
Dear Gui-Dong,
Not sure what the responsibility is here with this driver, given it
never left staging. I've not looked at it myself for years, so genuine
question on my part as to who is responsible for patching it (if at
all). It doesn't have a maintainer anymore to my knowledge.
Also, apologies to be the bearer of bad news, but it upsets me to have
to report Larry Finger sadly passed on last year and is no longer with
us.
Regards,
Phil Potter
next prev parent reply other threads:[~2025-02-25 13:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-25 13:02 [BUG] r8188eu: Potential deadlocks in rtw_wx_set_wap/essid functions Gui-Dong Han
2025-02-25 13:57 ` Phillip Potter [this message]
2025-02-25 14:53 ` Dan Carpenter
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=Z73MMWEI7o59qzDL@equinox \
--to=phil@philpotter.co.uk \
--cc=baijiaju1990@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=hanguidong02@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=paskripkin@gmail.com \
--cc=stable@vger.kernel.org \
/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