mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stefan Kerkmann <s.kerkmann@pengutronix.de>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Brian Norris <briannorris@chromium.org>,
	Francesco Dolcini <francesco@dolcini.it>,
	Johannes Berg <johannes.berg@intel.com>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Jeff Chen <jeff.chen_1@nxp.com>,
	linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH next] wifi: mwifiex: fix double free in mwifiex_send_rgpower_table()
Date: Wed, 10 Sep 2025 15:10:44 +0200	[thread overview]
Message-ID: <c3f3370f-1f2c-4e35-81a4-4303aed2d438@pengutronix.de> (raw)
In-Reply-To: <aLqZBh5_dSHUb4AE@stanley.mountain>

Hi Dan,

thanks for spotting and fixing the double free error. I converted the 
code to use the cleanup helper late in the dev process and forgot to 
remove the call. I sent a patch for the endianness bug as well.

On 05.09.25 10:02, Dan Carpenter wrote:
> The "hostcmd" is freed using cleanup.h, so calling kfree() will lead to
> a double free.  Delete the kfree().
> 
> Fixes: 7b6f16a25806 ("wifi: mwifiex: add rgpower table loading support")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>   drivers/net/wireless/marvell/mwifiex/sta_cmd.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
> index 6d9e2af29a69..91d5098081e8 100644
> --- a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
> +++ b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
> @@ -1521,10 +1521,8 @@ int mwifiex_send_rgpower_table(struct mwifiex_private *priv, const u8 *data,
>   		return -ENOMEM;
>   
>   	_data = kmemdup(data, size, GFP_KERNEL);
> -	if (!_data) {
> -		kfree(hostcmd);
> +	if (!_data)
>   		return -ENOMEM;
> -	}
>   
>   	pos = _data;
>   	ptr = hostcmd->cmd;

Thank you,
Stefan

-- 
Pengutronix e.K.                       | Stefan Kerkmann             |
Steuerwalder Str. 21                   | https://www.pengutronix.de/ |
31137 Hildesheim, Germany              | Phone: +49-5121-206917-128  |
Amtsgericht Hildesheim, HRA 2686       | Fax:   +49-5121-206917-9    |


      parent reply	other threads:[~2025-09-10 13:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-05  8:02 Dan Carpenter
2025-09-05  8:32 ` Francesco Dolcini
2025-09-10 13:10 ` Stefan Kerkmann [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=c3f3370f-1f2c-4e35-81a4-4303aed2d438@pengutronix.de \
    --to=s.kerkmann@pengutronix.de \
    --cc=briannorris@chromium.org \
    --cc=dan.carpenter@linaro.org \
    --cc=francesco@dolcini.it \
    --cc=jeff.chen_1@nxp.com \
    --cc=johannes.berg@intel.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=s.hauer@pengutronix.de \
    /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®