From: sashiko-bot@kernel.org
To: "Wei Jie Law" <law.wei.jie@gt.tech.gov.sg>
Cc: linux-usb@vger.kernel.org
Subject: Re: [PATCH net 2/2] net: usb: lan78xx: reject short register and statistics reads
Date: Wed, 14 Oct 2026 03:04:44 +0000 [thread overview]
Message-ID: <sashiko-outbox-170753@kernel.org> (raw)
In-Reply-To: <20261014025602.26334-3-law.wei.jie@gt.tech.gov.sg>
> lan78xx_read_reg() and lan78xx_read_stats() read from the device into
> a freshly kmalloc()ed buffer, but only treat a negative return value
> from usb_control_msg() as an error. A device that answers with fewer
> bytes than requested leaves part or all of the buffer uninitialized,
> and those bytes are then used as the register value or the counters.
>
> With an emulated device on a kernel booted with init_on_alloc=0:
>
> - A zero-length reply to the statistics request makes ethtool -S, which
> needs no privileges, report the stale contents of the kmalloc-192
> buffer. One counter pair read back as 0xffffffff8a427800, the
> address of usb_api_blocking_completion(), next to several direct
> map pointers.
>
> - A zero-length reply to the RX_ADDRL/RX_ADDRH reads in
> [ ... ]
>
> Fixes: 55d7de9de6c3 ("Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver")
> Cc: stable@vger.kernel.org
> Assisted-by: LLM
> Signed-off-by: Wei Jie Law <law.wei.jie@gt.tech.gov.sg>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261014025602.26334-1-law.wei.jie@gt.tech.gov.sg?part=2
prev parent reply other threads:[~2026-10-14 3:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-14 2:56 [PATCH net 0/2] net: usb: lan78xx: do not use uninitialized data after short reads Wei Jie Law
2026-10-14 2:56 ` [PATCH net 1/2] net: usb: lan78xx: do not update statistics after a failed read Wei Jie Law
2026-10-14 3:04 ` sashiko-bot
2026-10-14 2:56 ` [PATCH net 2/2] net: usb: lan78xx: reject short register and statistics reads Wei Jie Law
2026-10-14 3:04 ` 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-170753@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=law.wei.jie@gt.tech.gov.sg \
--cc=linux-usb@vger.kernel.org \
--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.