All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net 0/2] net: usb: lan78xx: do not use uninitialized data after short reads
@ 2026-10-14  2:56 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  2:56 ` [PATCH net 2/2] net: usb: lan78xx: reject short register and statistics reads Wei Jie Law
  0 siblings, 2 replies; 5+ messages in thread
From: Wei Jie Law @ 2026-10-14  2:56 UTC (permalink / raw)
  To: Thangaraj Samynathan, UNGLinuxDriver, Andrew Lunn,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Woojung Huh, netdev, linux-usb, linux-kernel, Wei Jie Law

lan78xx_read_reg() and lan78xx_read_stats() accept a control transfer
that returns fewer bytes than requested and then use the uninitialized
rest of their kmalloc()ed buffers. A device that sends short replies can
get stale heap contents written back to it as the MAC address, and makes
ethtool -S report them to unprivileged users, including kernel text and
direct map pointers, on systems with init_on_alloc=0.

Patch 2 makes both helpers fail on short reads. Patch 1 comes first so
that a failing statistics read does not report uninitialized stack data
instead.

The bugs need a malicious or emulated USB device, which
Documentation/process/threat-model.rst treats as a regular bug rather
than a vulnerability, so they are posted publicly.

Testing: the series builds without warnings (W=1) on net and passes
checkpatch --strict. It applies unchanged to v6.12.105, where it was
tested with a LAN7800 emulated by raw-gadget + dummy_hcd, booted with
init_on_alloc=0:

- Zero-length statistics replies. Before: 40 to 88 of the 235 ethtool -S
  counters are non-zero, including usb_api_blocking_completion() and
  direct map pointers. After: every read fails with -EIO and all
  counters stay zero.

- Zero-length RX_ADDRL/RX_ADDRH replies. Before: the MAC address
  differs on every probe and is written back to the device. After: the
  probe fails with -EIO.

Both bugs were found, and the patches written, with LLM assistance,
hence the Assisted-by tags.

Wei Jie Law (2):
  net: usb: lan78xx: do not update statistics after a failed read
  net: usb: lan78xx: reject short register and statistics reads

 drivers/net/usb/lan78xx.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)


base-commit: af32da41b0327b9c6a37856ba82b6760d6c8d10e
-- 
2.43.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-10-14  3:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 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.