Linux kernel source tree
Go to file
Bhanu Seshu Kumar Valluri 49bdb63ff6 net: usb: lan78xx: Fix lost EEPROM read timeout error(-ETIMEDOUT) in lan78xx_read_raw_eeprom
Syzbot reported read of uninitialized variable BUG with following call stack.

lan78xx 8-1:1.0 (unnamed net_device) (uninitialized): EEPROM read operation timeout
=====================================================
BUG: KMSAN: uninit-value in lan78xx_read_eeprom drivers/net/usb/lan78xx.c:1095 [inline]
BUG: KMSAN: uninit-value in lan78xx_init_mac_address drivers/net/usb/lan78xx.c:1937 [inline]
BUG: KMSAN: uninit-value in lan78xx_reset+0x999/0x2cd0 drivers/net/usb/lan78xx.c:3241
 lan78xx_read_eeprom drivers/net/usb/lan78xx.c:1095 [inline]
 lan78xx_init_mac_address drivers/net/usb/lan78xx.c:1937 [inline]
 lan78xx_reset+0x999/0x2cd0 drivers/net/usb/lan78xx.c:3241
 lan78xx_bind+0x711/0x1690 drivers/net/usb/lan78xx.c:3766
 lan78xx_probe+0x225c/0x3310 drivers/net/usb/lan78xx.c:4707

Local variable sig.i.i created at:
 lan78xx_read_eeprom drivers/net/usb/lan78xx.c:1092 [inline]
 lan78xx_init_mac_address drivers/net/usb/lan78xx.c:1937 [inline]
 lan78xx_reset+0x77e/0x2cd0 drivers/net/usb/lan78xx.c:3241
 lan78xx_bind+0x711/0x1690 drivers/net/usb/lan78xx.c:3766

The function lan78xx_read_raw_eeprom failed to properly propagate EEPROM
read timeout errors (-ETIMEDOUT). In the fallthrough path, it first
attempted to restore the pin configuration for LED outputs and then
returned only the status of that restore operation, discarding the
original timeout error.

As a result, callers could mistakenly treat the data buffer as valid
even though the EEPROM read had actually timed out with no data or partial
data.

To fix this, handle errors in restoring the LED pin configuration separately.
If the restore succeeds, return any prior EEPROM timeout error correctly
to the caller.

Reported-by: syzbot+62ec8226f01cb4ca19d9@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=62ec8226f01cb4ca19d9
Fixes: 8b1b2ca83b ("net: usb: lan78xx: Improve error handling in EEPROM and OTP operations")
Signed-off-by: Bhanu Seshu Kumar Valluri <bhanuseshukumar@gmail.com>
Reviewed-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://patch.msgid.link/20250930084902.19062-1-bhanuseshukumar@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2025-10-03 10:15:35 -07:00
Documentation Networking changes for 6.18. 2025-10-02 15:17:01 -07:00
LICENSES
arch Networking changes for 6.18. 2025-10-02 15:17:01 -07:00
block for-6.18/block-20250929 2025-10-02 10:16:56 -07:00
certs
crypto bpf-next-6.18 2025-09-30 17:58:11 -07:00
drivers net: usb: lan78xx: Fix lost EEPROM read timeout error(-ETIMEDOUT) in lan78xx_read_raw_eeprom 2025-10-03 10:15:35 -07:00
fs for-6.18/block-20250929 2025-10-02 10:16:56 -07:00
include Networking changes for 6.18. 2025-10-02 15:17:01 -07:00
init Kbuild updates for 6.18 2025-10-01 20:58:51 -07:00
io_uring Networking changes for 6.18. 2025-10-02 15:17:01 -07:00
ipc namespace-6.18-rc1 2025-09-29 11:20:29 -07:00
kernel Networking changes for 6.18. 2025-10-02 15:17:01 -07:00
lib for-6.18/block-20250929 2025-10-02 10:16:56 -07:00
mm Networking changes for 6.18. 2025-10-02 15:17:01 -07:00
net Networking changes for 6.18. 2025-10-02 15:17:01 -07:00
rust Networking changes for 6.18. 2025-10-02 15:17:01 -07:00
samples [GIT PULL for v6.18] media updates 2025-10-02 13:13:26 -07:00
scripts Networking changes for 6.18. 2025-10-02 15:17:01 -07:00
security bitmap-for-6.18 2025-10-02 08:57:03 -07:00
sound sound updates for 6.18-rc1 2025-10-02 11:37:19 -07:00
tools Networking changes for 6.18. 2025-10-02 15:17:01 -07:00
usr
virt
.clang-format
.clippy.toml
.cocciconfig
.editorconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap Networking changes for 6.18. 2025-10-02 15:17:01 -07:00
.pylintrc
.rustfmt.toml
COPYING
CREDITS MAINTAINERS: Delete inactive maintainers from AF_XDP 2025-09-25 13:18:22 +02:00
Kbuild sched: Make migrate_{en,dis}able() inline 2025-09-25 09:57:16 +02:00
Kconfig
MAINTAINERS Networking changes for 6.18. 2025-10-02 15:17:01 -07:00
Makefile Kbuild updates for 6.18 2025-10-01 20:58:51 -07:00
README

README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the reStructuredText markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.