From: sashiko-bot@kernel.org
To: "Liu Chao" <liuc63@xiaopeng.com>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH v5 2/2] usb: gadget: u_ether: fix out-of-bounds read in get_ether_addr
Date: Tue, 17 Nov 2026 09:08:56 +0000 [thread overview]
Message-ID: <sashiko-outbox-218450@kernel.org> (raw)
In-Reply-To: <20261117090110.3263592-3-liuc63@xiaopeng.com>
> get_ether_addr() walks the MAC address string with a fixed six iteration
> loop, calling hex_to_bin() twice per iteration, and never checks for the
> terminating NUL. A short string therefore makes it read past the end of
> the buffer. The dev_addr and host_addr module parameters of the legacy
> gadget drivers are copied into their own kmalloc'ed buffer by
> param_set_charp(), so the overrun crosses a slab boundary and KASAN
> reports it at insmod time:
>
> # insmod g_ether.ko dev_addr=ab
>
> BUG: KASAN: slab-out-of-bounds in get_ether_addr+0x1ec/0x230
> Read of size 1 at addr ffff888009f91f53 by task insmod/70
> ...
> get_ether_addr+0x1ec/0x230
> gether_set_dev_addr+0x6b/0x180
> [ ... ]
> commit that actually introduced the loop is named here in prose.
>
> Suggested-by: Andy Shevchenko <andriy.shevchenko@intel.com>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Signed-off-by: Liu Chao <liuc63@xiaopeng.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261117090110.3263592-1-liuc63@xiaopeng.com?part=2
prev parent reply other threads:[~2026-11-17 9:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 9:00 [PATCH v5 0/2] usb: gadget: u_ether: fix out-of-bounds read in get_ether_addr Liu Chao
2026-11-17 9:00 ` [PATCH v5 1/2] lib/net_utils: allow mac_pton() to take a custom delimiter Liu Chao
2026-11-17 9:08 ` sashiko-bot
2026-11-17 9:00 ` [PATCH v5 2/2] usb: gadget: u_ether: fix out-of-bounds read in get_ether_addr Liu Chao
2026-11-17 9:08 ` sashiko-bot [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=sashiko-outbox-218450@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=liuc63@xiaopeng.com \
--cc=sashiko-reviews@lists.linux.dev \
/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.