From: Ping-Ke Shih <pkshih@realtek.com>
To: Anvik Loitongbam <permissiontogallop@gmail.com>,
Jes Sorensen <Jes.Sorensen@gmail.com>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>
Subject: RE: [PATCH] wifi: rtl8xxxu: validate firmware size before parsing
Date: Sun, 22 Nov 2026 03:08:05 +0000 [thread overview]
Message-ID: <6fad320e93974775b64f35460df423f8@realtek.com> (raw)
In-Reply-To: <20261121170559.149274-1-permissiontogallop@gmail.com>
Anvik Loitongbam <permissiontogallop@gmail.com> wrote:
> rtl8xxxu_load_firmware() copies fw->size bytes and then subtracts the
> fixed firmware header size from fw->size without checking that the file
> is large enough. A short firmware file with a valid signature makes
> fw_size wrap to a huge size_t; the revision logging then reads the
> header fields out of bounds, and the download path derives an
> out-of-bounds data pointer.
>
> A 2-byte rtlwifi/rtl8192eu_nic.bin containing the 0x92c0 signature,
It looks like you make a fake firmware to trigger KASAN?
> loaded while the driver probes a Foxin RTL8192EU (0bda:818b) passed
> through to a KASAN guest, reproduces it:
>
> BUG: KASAN: slab-out-of-bounds in rtl8xxxu_load_firmware+0x238/0x2ae
> Read of size 1
> ...
> The buggy address is located 4 bytes to the right of
> allocated 2-byte region
> ...
> kmemdup_noprof
> rtl8xxxu_load_firmware
> rtl8192eu_load_firmware
> rtl8xxxu_probe
>
> Reject firmware smaller than struct rtl8xxxu_firmware_header before
> copying or parsing it. With this change the probe fails with -EINVAL
> and KASAN reports nothing.
>
> The issue and the initial fix were tested on a Foxin
> RTL8192EU (0bda:818b) passed through to a KASAN guest.
> I would be happy to provide the reproducer on request.
>
> Fixes: 26f1fad29ad9 ("New driver: rtl8xxxu (mac80211)")
If this isn't a real case, I don't want the tag.
> Signed-off-by: Anvik Loitongbam <permissiontogallop@gmail.com>
Also, the subject has clearly pointed out the purpose of this
commit, so reduce the commit message as what it is actually needed.
Recently, we have a lot of patches to validate boundary. They are
fine to me, but I don't want much commit message, which is not
very useful.
pw-bot: cr
prev parent reply other threads:[~2026-11-22 3:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-21 17:05 [PATCH] wifi: rtl8xxxu: validate firmware size before parsing Anvik Loitongbam
2026-11-22 3:08 ` 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=6fad320e93974775b64f35460df423f8@realtek.com \
--to=pkshih@realtek.com \
--cc=Jes.Sorensen@gmail.com \
--cc=linux-wireless@vger.kernel.org \
--cc=permissiontogallop@gmail.com \
/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