From: Andrew Lunn <andrew@lunn.ch>
To: Wei Jie Law <law.wei.jie@gt.tech.gov.sg>
Cc: Thangaraj Samynathan <Thangaraj.S@microchip.com>,
UNGLinuxDriver@microchip.com, Andrew Lunn <andrew+netdev@lunn.ch>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Woojung Huh <woojung.huh@microchip.com>,
netdev@vger.kernel.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, Wei Jie Law <98lawweijie@gmail.com>,
stable@vger.kernel.org
Subject: Re: [PATCH net v4 1/2] net: usb: lan78xx: do not update statistics after a failed read
Date: Tue, 20 Oct 2026 02:36:16 +0200 [thread overview]
Message-ID: <4080c576-e612-4192-965e-4df444f65b62@lunn.ch> (raw)
In-Reply-To: <20261020001621.2920-2-law.wei.jie@gt.tech.gov.sg>
On Tue, Oct 20, 2026 at 08:16:20AM +0800, Wei Jie Law wrote:
> lan78xx_update_stats() reads the hardware counters into an on-stack
> struct lan78xx_statstage. If lan78xx_read_stats() fails, only the
> rollover check is skipped: the counters are still recomputed from the
> uninitialized stack buffer and stored in dev->stats.curr_stat, which is
> then reported to user space by ethtool -S.
>
> Keep the previous values when the read fails.
>
> Found by code review with LLM assistance. Tested together with the next
> patch, which makes short reads fail: with an emulated device, ethtool -S
> then keeps reporting the previous counters.
>
> Fixes: 20ff55655a93 ("lan78xx: handle statistics counter rollover")
> Cc: stable@vger.kernel.org
> Assisted-by: LLM
> Signed-off-by: Wei Jie Law <law.wei.jie@gt.tech.gov.sg>
net-next please.
https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
next prev parent reply other threads:[~2026-10-20 0:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-20 0:16 [PATCH net v4 0/2] net: usb: lan78xx: do not use uninitialized data after short reads Wei Jie Law
2026-10-20 0:16 ` [PATCH net v4 1/2] net: usb: lan78xx: do not update statistics after a failed read Wei Jie Law
2026-10-20 0:36 ` Andrew Lunn [this message]
2026-10-20 0:16 ` [PATCH net v4 2/2] net: usb: lan78xx: reject short register and statistics transfers Wei Jie Law
2026-10-20 0:35 ` Andrew Lunn
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=4080c576-e612-4192-965e-4df444f65b62@lunn.ch \
--to=andrew@lunn.ch \
--cc=98lawweijie@gmail.com \
--cc=Thangaraj.S@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=kuba@kernel.org \
--cc=law.wei.jie@gt.tech.gov.sg \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stable@vger.kernel.org \
--cc=woojung.huh@microchip.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
all inboxes | Powered by JetHome®