* [PATCH] wifi: rtw89: wow: Add unlock mutex before to return
@ 2024-10-01 9:13 Alessandro Zanni
2024-10-04 4:13 ` Ping-Ke Shih
0 siblings, 1 reply; 2+ messages in thread
From: Alessandro Zanni @ 2024-10-01 9:13 UTC (permalink / raw)
To: pkshih, kvalo
Cc: Alessandro Zanni, linux-wireless, linux-kernel, skhan, anupnewsmail
In error handling code for "ieee80211_gtk_rekey_add failed", release
the mutex before to return.
Found with Coccinelle static analisys tool,
script: https://coccinelle.gitlabpages.inria.fr/website/rules/mut.cocci
Signed-off-by: Alessandro Zanni <alessandro.zanni87@gmail.com>
---
drivers/net/wireless/realtek/rtw89/wow.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/wireless/realtek/rtw89/wow.c b/drivers/net/wireless/realtek/rtw89/wow.c
index 86e24e07780d..8045acb27cf9 100644
--- a/drivers/net/wireless/realtek/rtw89/wow.c
+++ b/drivers/net/wireless/realtek/rtw89/wow.c
@@ -624,6 +624,7 @@ static struct ieee80211_key_conf *rtw89_wow_gtk_rekey(struct rtw89_dev *rtwdev,
kfree(rekey_conf);
if (IS_ERR(key)) {
rtw89_err(rtwdev, "ieee80211_gtk_rekey_add failed\n");
+ mutex_unlock(&rtwdev->mutex);
return NULL;
}
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* RE: [PATCH] wifi: rtw89: wow: Add unlock mutex before to return
2024-10-01 9:13 [PATCH] wifi: rtw89: wow: Add unlock mutex before to return Alessandro Zanni
@ 2024-10-04 4:13 ` Ping-Ke Shih
0 siblings, 0 replies; 2+ messages in thread
From: Ping-Ke Shih @ 2024-10-04 4:13 UTC (permalink / raw)
To: Alessandro Zanni, kvalo; +Cc: linux-wireless, linux-kernel, skhan, anupnewsmail
Alessandro Zanni <alessandro.zanni87@gmail.com> wrote:
> In error handling code for "ieee80211_gtk_rekey_add failed", release
> the mutex before to return.
>
> Found with Coccinelle static analisys tool,
> script: https://coccinelle.gitlabpages.inria.fr/website/rules/mut.cocci
>
> Signed-off-by: Alessandro Zanni <alessandro.zanni87@gmail.com>
> ---
> drivers/net/wireless/realtek/rtw89/wow.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/wireless/realtek/rtw89/wow.c b/drivers/net/wireless/realtek/rtw89/wow.c
> index 86e24e07780d..8045acb27cf9 100644
> --- a/drivers/net/wireless/realtek/rtw89/wow.c
> +++ b/drivers/net/wireless/realtek/rtw89/wow.c
> @@ -624,6 +624,7 @@ static struct ieee80211_key_conf *rtw89_wow_gtk_rekey(struct rtw89_dev *rtwdev,
> kfree(rekey_conf);
> if (IS_ERR(key)) {
> rtw89_err(rtwdev, "ieee80211_gtk_rekey_add failed\n");
> + mutex_unlock(&rtwdev->mutex);
> return NULL;
> }
The driver mutex is held across this function. Only unlock before calling
ieee80211_gtk_rekey_add() and lock after that, because the function enters
driver again and lock mutex again causing deadlock.
Thus this Coccinelle finding is false alarm. NACK this patch.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-10-04 4:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-01 9:13 [PATCH] wifi: rtw89: wow: Add unlock mutex before to return Alessandro Zanni
2024-10-04 4:13 ` Ping-Ke Shih
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®