mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jeff Chen <jeff.chen_1@nxp.com>
To: Zilin Guan <zilin@seu.edu.cn>
Cc: briannorris@chromium.org, francesco@dolcini.it,
	linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
	jianhao.xu@seu.edu.cn
Subject: Re: [PATCH] wireless: mwifiex: Fix memory leak in mwifiex_11n_aggregate_pkt()
Date: Fri, 23 Jan 2026 23:38:43 +0800	[thread overview]
Message-ID: <aXOWA8RW3Bz62jMa@nxpwireless-Inspiron-14-Plus-7440> (raw)
In-Reply-To: <20260119092625.1349934-1-zilin@seu.edu.cn>

On Mon, Jan 19, 2026 at 09:26:25 AM +0000, Zilin Guan wrote:
> In mwifiex_11n_aggregate_pkt(), skb_aggr is allocated via
> mwifiex_alloc_dma_align_buf(). If mwifiex_is_ralist_valid() returns false,
> the function currently returns -1 immediately without freeing the
> previously allocated skb_aggr, causing a memory leak.
> 
> Since skb_aggr has not yet been queued via skb_queue_tail(), no other
> references to this memory exist. Therefore, it has to be freed locally
> before returning the error.
> 
> Fix this by calling mwifiex_write_data_complete() to free skb_aggr before
> returning the error status.
> 
> Compile tested only. Issue found using a prototype static analysis tool
> and code review.
> 
> Fixes: 5e6e3a92b9a4 ("wireless: mwifiex: initial commit for Marvell mwifiex driver")
> Signed-off-by: Zilin Guan <zilin@seu.edu.cn>
> ---
>  drivers/net/wireless/marvell/mwifiex/11n_aggr.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/wireless/marvell/mwifiex/11n_aggr.c b/drivers/net/wireless/marvell/mwifiex/11n_aggr.c
> index 34b4b34276d6..042b1fe5f0d6 100644
> --- a/drivers/net/wireless/marvell/mwifiex/11n_aggr.c
> +++ b/drivers/net/wireless/marvell/mwifiex/11n_aggr.c
> @@ -203,6 +203,7 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv,
>  
>  		if (!mwifiex_is_ralist_valid(priv, pra_list, ptrindex)) {
>  			spin_unlock_bh(&priv->wmm.ra_list_spinlock);
> +			mwifiex_write_data_complete(adapter, skb_aggr, 1, -1);
>  			return -1;
>  		}
>  
> -- 
> 2.34.1
> 
> 

Hi Zilin,

Patch looks good to me.

Reviewed-by: Jeff Chen <jeff.chen_1@nxp.com>

      reply	other threads:[~2026-01-23 15:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-19  9:26 Zilin Guan
2026-01-23 15:38 ` Jeff Chen [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=aXOWA8RW3Bz62jMa@nxpwireless-Inspiron-14-Plus-7440 \
    --to=jeff.chen_1@nxp.com \
    --cc=briannorris@chromium.org \
    --cc=francesco@dolcini.it \
    --cc=jianhao.xu@seu.edu.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=zilin@seu.edu.cn \
    /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®