mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ping-Ke Shih <pkshih@realtek.com>
To: Alessandro Zanni <alessandro.zanni87@gmail.com>,
	"kvalo@kernel.org" <kvalo@kernel.org>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"skhan@linuxfoundation.org" <skhan@linuxfoundation.org>,
	"anupnewsmail@gmail.com" <anupnewsmail@gmail.com>
Subject: RE: [PATCH] wifi: rtw89: wow: Add unlock mutex before to return
Date: Fri, 4 Oct 2024 04:13:42 +0000	[thread overview]
Message-ID: <61b75a0d3b7047bb93c4abfa7de8c046@realtek.com> (raw)
In-Reply-To: <20241001091320.38687-1-alessandro.zanni87@gmail.com>

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. 



      reply	other threads:[~2024-10-04  4:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-01  9:13 Alessandro Zanni
2024-10-04  4:13 ` Ping-Ke Shih [this message]

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=61b75a0d3b7047bb93c4abfa7de8c046@realtek.com \
    --to=pkshih@realtek.com \
    --cc=alessandro.zanni87@gmail.com \
    --cc=anupnewsmail@gmail.com \
    --cc=kvalo@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=skhan@linuxfoundation.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

all inboxes | Powered by JetHome®