From: Fabio Aiuto <fabioaiuto83@gmail.com>
To: gregkh@linuxfoundation.org
Cc: hdegoede@redhat.com, Larry.Finger@lwfinger.net,
linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
Fabio Aiuto <fabioaiuto83@gmail.com>
Subject: [PATCH] staging: rtl8723bs: protect sleepq_len access by sleep_q.lock
Date: Mon, 13 Sep 2021 15:03:46 +0200 [thread overview]
Message-ID: <20210913130346.2390-1-fabioaiuto83@gmail.com> (raw)
protect sleepq_len access by sleep_q.lock and move
pxmitpriv->lock after sleep_q.lock release.
This fixes and completes a lockdep warning silencing
done in a prevoius commit where accesses to sleep_q
related fields were protected by sleep_q.lock instead
of pxmitpriv->lock.
Note that sleep_q.lock is already taken inside
rtw_free_xmitframe_queue so we just wrap sleepq_len
access.
Moved pxmitpriv->lock after sleep_q.lock release to
avoid locks nesting.
Fixes: 78a1614a81f0 ("staging: rtl8723bs: remove possible deadlock when disconnect")
Reported-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Fabio Aiuto <fabioaiuto83@gmail.com>
Signed-off-by: Fabio Aiuto <fabioaiuto83@gmail.com>
---
drivers/staging/rtl8723bs/core/rtw_sta_mgt.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c b/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c
index bf090f3b1db6..c98918e02afe 100644
--- a/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c
+++ b/drivers/staging/rtl8723bs/core/rtw_sta_mgt.c
@@ -294,10 +294,12 @@ u32 rtw_free_stainfo(struct adapter *padapter, struct sta_info *psta)
/* list_del_init(&psta->wakeup_list); */
- spin_lock_bh(&pxmitpriv->lock);
-
rtw_free_xmitframe_queue(pxmitpriv, &psta->sleep_q);
+ spin_lock_bh(&psta->sleep_q.lock);
psta->sleepq_len = 0;
+ spin_unlock_bh(&psta->sleep_q.lock);
+
+ spin_lock_bh(&pxmitpriv->lock);
/* vo */
/* spin_lock_bh(&(pxmitpriv->vo_pending.lock)); */
--
2.20.1
next reply other threads:[~2021-09-13 13:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-13 13:03 Fabio Aiuto [this message]
2021-09-13 13:24 ` [PATCH] staging: rtl8723bs: protect sleepq_len access by sleep_q.lock Hans de Goede
2021-09-13 13:39 ` Fabio Aiuto
2021-09-13 15:12 ` Hans de Goede
2021-09-17 14:25 ` Greg KH
2021-09-17 14:27 ` Fabio Aiuto
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=20210913130346.2390-1-fabioaiuto83@gmail.com \
--to=fabioaiuto83@gmail.com \
--cc=Larry.Finger@lwfinger.net \
--cc=gregkh@linuxfoundation.org \
--cc=hdegoede@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
/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