All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
To: Dawei Feng <dawei.feng@seu.edu.cn>, johannes@sipsolutions.net
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
	jianhao.xu@seu.edu.cn, stable@vger.kernel.org,
	Zilin Guan <zilin@seu.edu.cn>
Subject: Re: [PATCH net] wifi: mac80211: fix memory leak in ieee80211_register_hw()
Date: Mon, 8 Jun 2026 10:24:07 -0700	[thread overview]
Message-ID: <dffefec6-14e0-4a87-85dd-97d328fedb50@oss.qualcomm.com> (raw)
In-Reply-To: <20260608145543.3443390-1-dawei.feng@seu.edu.cn>

On 6/8/2026 7:55 AM, Dawei Feng wrote:
> If kmemdup() fails while copying supported band structures, the error
> path jumps to fail_rate. This skips rate_control_deinitialize() and
> leaks the initialized local->rate_ctrl.
> 
> Fix this by redirecting the error path to fail_wiphy_register to
> ensure proper cleanup.
> 
> The bug was first flagged by an experimental analysis tool we are
> developing for kernel memory-management bugs while analyzing
> v6.13-rc1. The tool is still under development and is not yet publicly
> available. Manual inspection confirms that the bug is still present in
> v7.1-rc7.
> 
> An x86_64 allyesconfig build showed no new warnings. As we do not have a
> suitable mac80211 device/driver combination to test with, no runtime
> testing was able to be performed.
> 
> Fixes: 09b4a4faf9d0 ("mac80211: introduce capability flags for VHT EXT NSS support")
> Cc: stable@vger.kernel.org
> Signed-off-by: Zilin Guan <zilin@seu.edu.cn>

why is this SOB here?

> Signed-off-by: Dawei Feng <dawei.feng@seu.edu.cn>

this is the posted author of the patch, and this patch hasn't been posted
previously, so it is unclear why there is an additional S-o-b

> ---
>  net/mac80211/main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/mac80211/main.c b/net/mac80211/main.c
> index f47dd58770ad..9306e0af3b5f 100644
> --- a/net/mac80211/main.c
> +++ b/net/mac80211/main.c
> @@ -1599,7 +1599,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
>  		sband = kmemdup(sband, sizeof(*sband), GFP_KERNEL);
>  		if (!sband) {
>  			result = -ENOMEM;
> -			goto fail_rate;
> +			goto fail_wiphy_register;

I'm wondering if it would be more logical to have another label at the same
place, i.e. fail_band, since it is illogical to goto fail_wiphy_register when
you aren't performing the wiphy_register function

>  		}
>  
>  		wiphy_dbg(hw->wiphy, "copying sband (band %d) due to VHT EXT NSS BW flag\n",




  reply	other threads:[~2026-06-08 17:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-08 14:55 [PATCH net] wifi: mac80211: fix memory leak in ieee80211_register_hw() Dawei Feng
2026-06-08 17:24 ` Jeff Johnson [this message]
2026-06-09  7:40   ` Dawei Feng
2026-07-06 11:47     ` Johannes Berg
2026-07-06 14:24       ` Dawei Feng

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=dffefec6-14e0-4a87-85dd-97d328fedb50@oss.qualcomm.com \
    --to=jeff.johnson@oss.qualcomm.com \
    --cc=dawei.feng@seu.edu.cn \
    --cc=jianhao.xu@seu.edu.cn \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=stable@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.