mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ping-Ke Shih <pkshih@realtek.com>
To: Mauricio Faria de Oliveira <mfo@igalia.com>,
	<linux-wireless@vger.kernel.org>
Cc: Ping-Ke Shih <pkshih@realtek.com>,
	Po-Hao Huang <phhuang@realtek.com>, Kalle Valo <kvalo@kernel.org>,
	<kernel-dev@igalia.com>, <linux-kernel@vger.kernel.org>,
	<stable@vger.kernel.org>,
	Mauricio Faria de Oliveira <mfo@igalia.com>,
	Luka Gejak <luka.gejak@linux.dev>
Subject: Re: [PATCH v2] wifi: rtw88: fix skb leak in hw_scan probe request length check
Date: Tue, 17 Nov 2026 16:24:04 +0800	[thread overview]
Message-ID: <4f05b7e9-211f-458a-a73a-8b4708317f9e@RTKEXHMBS05.realtek.com.tw> (raw)
In-Reply-To: <20261116-rtw88-hw-scan-skb-leak-v2-1-cc9644774fff@igalia.com>

Mauricio Faria de Oliveira <mfo@igalia.com> wrote:

> In _rtw_hw_scan_update_probe_req(), if the first loop fails (goto out;) the
> skb is leaked. It does not reach kfree_skb() at the end of the loop body or
> in the second loop (out:) since it is unlinked from probe_req_list.
> 
> Fix the leak by calling kfree_skb() if the first loop fails.
> 
> In /sys/kernel/debug/kmemleak, after simulating the failure:
> 
>   unreferenced object 0xffff88810965a000 (size 232):
>     comm "iw", pid 4729, jiffies 4345008185
>     hex dump (first 32 bytes):
>       00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
>       00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
>     backtrace (crc 20f7de11):
>       kmem_cache_alloc_node_noprof+0x302/0x380
>       __alloc_skb+0x74/0x2f0
>       skb_copy+0x57/0xe0
>       rtw_hw_scan_update_probe_req+0xff/0x230
>       rtw_hw_scan_prehandle+0x4e/0x180
>       rtw_hw_scan_offload+0x186/0x1d0
>       rtw_ops_hw_scan+0x61/0xb0
>       drv_hw_scan+0x81/0x130
>       __ieee80211_start_scan+0x2e0/0x760
>       rdev_scan+0x42/0x100
>       nl80211_trigger_scan+0x53b/0x730
>       genl_family_rcv_msg_doit+0x103/0x160
>       genl_rcv_msg+0x1b5/0x2c0
>       netlink_rcv_skb+0x52/0x100
>       genl_rcv+0x28/0x40
>       netlink_unicast+0x26d/0x3b0
> 
> This leak exists in the first loop since the function was introduced, and
> still happened with the addition of the second loop, in these two commits:
> 
> Fixes: 10d162b2ed39 ("rtw88: 8822c: add ieee80211_ops::hw_scan")
> Fixes: d95984b5580d ("rtw88: fix memory overrun and memory leak during hw_scan")
> Cc: stable@vger.kernel.org
> Signed-off-by: Mauricio Faria de Oliveira <mfo@igalia.com>
> Reviewed-by: Luka Gejak <luka.gejak@linux.dev>

1 patch(es) applied to rtw-next branch of rtw.git, thanks.

432441d951ca wifi: rtw88: fix skb leak in hw_scan probe request length check

---
https://github.com/pkshih/rtw.git


      reply	other threads:[~2026-11-17  8:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16 16:17 Mauricio Faria de Oliveira
2026-11-17  8:24 ` 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=4f05b7e9-211f-458a-a73a-8b4708317f9e@RTKEXHMBS05.realtek.com.tw \
    --to=pkshih@realtek.com \
    --cc=kernel-dev@igalia.com \
    --cc=kvalo@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=luka.gejak@linux.dev \
    --cc=mfo@igalia.com \
    --cc=phhuang@realtek.com \
    --cc=stable@vger.kernel.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®