The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [syzbot] [net?] [usb?] WARNING in mdiobus_get_phy
@ 2025-12-15 12:30 syzbot
  2025-12-17  6:27 ` Forwarded: [PATCH] net: usb: asix: validate PHY address before use syzbot
  0 siblings, 1 reply; 3+ messages in thread
From: syzbot @ 2025-12-15 12:30 UTC (permalink / raw)
  To: andrew, davem, edumazet, hkallweit1, kuba, linux-kernel,
	linux-usb, linux, netdev, pabeni, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    5ce74bc1b7cb Add linux-next specific files for 20251211
git tree:       linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=130b51c2580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=b9f785244b836412
dashboard link: https://syzkaller.appspot.com/bug?extid=3d43c9066a5b54902232
compiler:       Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=13baa61a580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/e550c10060d5/disk-5ce74bc1.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/80331ba2b4cc/vmlinux-5ce74bc1.xz
kernel image: https://storage.googleapis.com/syzbot-assets/4bcb4f82dfcf/bzImage-5ce74bc1.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+3d43c9066a5b54902232@syzkaller.appspotmail.com

------------[ cut here ]------------
addr 207 out of range
WARNING: drivers/net/phy/mdio_bus.c:76 at mdiobus_find_device drivers/net/phy/mdio_bus.c:76 [inline], CPU#0: kworker/0:5/6044
WARNING: drivers/net/phy/mdio_bus.c:76 at mdiobus_get_phy+0xaf/0xd0 drivers/net/phy/mdio_bus.c:86, CPU#0: kworker/0:5/6044
Modules linked in:
CPU: 0 UID: 0 PID: 6044 Comm: kworker/0:5 Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/25/2025
Workqueue: usb_hub_wq hub_event
RIP: 0010:mdiobus_find_device drivers/net/phy/mdio_bus.c:76 [inline]
RIP: 0010:mdiobus_get_phy+0xb1/0xd0 drivers/net/phy/mdio_bus.c:86
Code: e8 34 1c 73 fb eb 07 e8 ed 17 73 fb 31 db 48 89 d8 5b 41 5e 41 5f c3 cc cc cc cc cc e8 d8 17 73 fb 48 8d 3d 31 16 81 09 89 de <67> 48 0f b9 3a eb db 89 f9 80 e1 07 80 c1 03 38 c1 7c b1 e8 57 7a
RSP: 0018:ffffc900033a6aa8 EFLAGS: 00010293
RAX: ffffffff864edf78 RBX: 00000000000000cf RCX: ffff88802a9ebd00
RDX: 0000000000000000 RSI: 00000000000000cf RDI: ffffffff8fcff5b0
RBP: ffffc900033a6bf0 R08: ffffc900033a6787 R09: 1ffff92000674cf0
R10: dffffc0000000000 R11: fffff52000674cf1 R12: ffff888078e2cdc0
R13: dffffc0000000000 R14: ffff88807cd12000 R15: dffffc0000000000
FS:  0000000000000000(0000) GS:ffff8881259e6000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f1c669c9e9c CR3: 000000000e13a000 CR4: 00000000003526f0
Call Trace:
 <TASK>
 ax88772_init_phy+0x8e/0x390 drivers/net/usb/asix_devices.c:722
 ax88772_bind+0x961/0xde0 drivers/net/usb/asix_devices.c:937
 usbnet_probe+0xab5/0x28f0 drivers/net/usb/usbnet.c:1802
 usb_probe_interface+0x668/0xc90 drivers/usb/core/driver.c:396
 call_driver_probe drivers/base/dd.c:-1 [inline]
 really_probe+0x26d/0xad0 drivers/base/dd.c:659
 __driver_probe_device+0x18c/0x320 drivers/base/dd.c:801
 driver_probe_device+0x4f/0x240 drivers/base/dd.c:831
 __device_attach_driver+0x279/0x430 drivers/base/dd.c:959
 bus_for_each_drv+0x251/0x2e0 drivers/base/bus.c:500
 __device_attach+0x2b8/0x430 drivers/base/dd.c:1031
 device_initial_probe+0xa1/0xd0 drivers/base/dd.c:1086
 bus_probe_device+0x12a/0x220 drivers/base/bus.c:574
 device_add+0x7b6/0xb80 drivers/base/core.c:3689
 usb_set_configuration+0x1a87/0x2110 drivers/usb/core/message.c:2210
 usb_generic_driver_probe+0x8d/0x150 drivers/usb/core/generic.c:250
 usb_probe_device+0x1c4/0x3c0 drivers/usb/core/driver.c:291
 call_driver_probe drivers/base/dd.c:-1 [inline]
 really_probe+0x26d/0xad0 drivers/base/dd.c:659
 __driver_probe_device+0x18c/0x320 drivers/base/dd.c:801
 driver_probe_device+0x4f/0x240 drivers/base/dd.c:831
 __device_attach_driver+0x279/0x430 drivers/base/dd.c:959
 bus_for_each_drv+0x251/0x2e0 drivers/base/bus.c:500
 __device_attach+0x2b8/0x430 drivers/base/dd.c:1031
 device_initial_probe+0xa1/0xd0 drivers/base/dd.c:1086
 bus_probe_device+0x12a/0x220 drivers/base/bus.c:574
 device_add+0x7b6/0xb80 drivers/base/core.c:3689
 usb_new_device+0xa39/0x1720 drivers/usb/core/hub.c:2695
 hub_port_connect drivers/usb/core/hub.c:5567 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5707 [inline]
 port_event drivers/usb/core/hub.c:5871 [inline]
 hub_event+0x29b1/0x4ef0 drivers/usb/core/hub.c:5953
 process_one_work+0x93a/0x15a0 kernel/workqueue.c:3279
 process_scheduled_works kernel/workqueue.c:3362 [inline]
 worker_thread+0x9b0/0xee0 kernel/workqueue.c:3443
 kthread+0x711/0x8a0 kernel/kthread.c:463
 ret_from_fork+0x599/0xb30 arch/x86/kernel/process.c:158
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:246
 </TASK>
----------------
Code disassembly (best guess):
   0:	e8 34 1c 73 fb       	call   0xfb731c39
   5:	eb 07                	jmp    0xe
   7:	e8 ed 17 73 fb       	call   0xfb7317f9
   c:	31 db                	xor    %ebx,%ebx
   e:	48 89 d8             	mov    %rbx,%rax
  11:	5b                   	pop    %rbx
  12:	41 5e                	pop    %r14
  14:	41 5f                	pop    %r15
  16:	c3                   	ret
  17:	cc                   	int3
  18:	cc                   	int3
  19:	cc                   	int3
  1a:	cc                   	int3
  1b:	cc                   	int3
  1c:	e8 d8 17 73 fb       	call   0xfb7317f9
  21:	48 8d 3d 31 16 81 09 	lea    0x9811631(%rip),%rdi        # 0x9811659
  28:	89 de                	mov    %ebx,%esi
* 2a:	67 48 0f b9 3a       	ud1    (%edx),%rdi <-- trapping instruction
  2f:	eb db                	jmp    0xc
  31:	89 f9                	mov    %edi,%ecx
  33:	80 e1 07             	and    $0x7,%cl
  36:	80 c1 03             	add    $0x3,%cl
  39:	38 c1                	cmp    %al,%cl
  3b:	7c b1                	jl     0xffffffee
  3d:	e8                   	.byte 0xe8
  3e:	57                   	push   %rdi
  3f:	7a                   	.byte 0x7a


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

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

* Forwarded: [PATCH] net: usb: asix: validate PHY address before use
  2025-12-15 12:30 [syzbot] [net?] [usb?] WARNING in mdiobus_get_phy syzbot
@ 2025-12-17  6:27 ` syzbot
  0 siblings, 0 replies; 3+ messages in thread
From: syzbot @ 2025-12-17  6:27 UTC (permalink / raw)
  To: linux-kernel, syzkaller-bugs

For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.

***

Subject: [PATCH] net: usb: asix: validate PHY address before use
Author: kartikey406@gmail.com

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master


The ASIX driver reads the PHY address from the USB device via
asix_read_phy_addr(). A malicious or faulty device can return an
invalid address (>= PHY_MAX_ADDR), which causes a warning in
mdiobus_get_phy():

  addr 207 out of range
  WARNING: drivers/net/phy/mdio_bus.c:76

Validate the PHY address before returning it from asix_read_phy_addr().

Reported-by: syzbot+3d43c9066a5b54902232@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=3d43c9066a5b54902232
Fixes: 7e88b11a862a ("net: usb: asix: refactor asix_read_phy_addr() and handle errors on return")
Signed-off-by: Deepanshu Kartikey <kartikey406@gmail.com>
---
 drivers/net/usb/asix_common.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/usb/asix_common.c b/drivers/net/usb/asix_common.c
index 7fd763917ae2..6ab3486072cb 100644
--- a/drivers/net/usb/asix_common.c
+++ b/drivers/net/usb/asix_common.c
@@ -335,6 +335,11 @@ int asix_read_phy_addr(struct usbnet *dev, bool internal)
 	offset = (internal ? 1 : 0);
 	ret = buf[offset];
 
+	if (ret >= PHY_MAX_ADDR) {
+		netdev_err(dev->net, "invalid PHY address: %d\n", ret);
+		return -ENODEV;
+	}
+
 	netdev_dbg(dev->net, "%s PHY address 0x%x\n",
 		   internal ? "internal" : "external", ret);
 
-- 
2.43.0


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

* Re: [syzbot] [net?] [usb?] WARNING in mdiobus_get_phy
       [not found] <20251217062735.268052-1-kartikey406@gmail.com>
@ 2025-12-17  8:40 ` syzbot
  0 siblings, 0 replies; 3+ messages in thread
From: syzbot @ 2025-12-17  8:40 UTC (permalink / raw)
  To: kartikey406, linux-kernel, syzkaller-bugs

Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-by: syzbot+3d43c9066a5b54902232@syzkaller.appspotmail.com
Tested-by: syzbot+3d43c9066a5b54902232@syzkaller.appspotmail.com

Tested on:

commit:         12b95d29 Add linux-next specific files for 20251217
git tree:       linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=13d0b51a580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=9b53f0e28d100777
dashboard link: https://syzkaller.appspot.com/bug?extid=3d43c9066a5b54902232
compiler:       Debian clang version 20.1.8 (++20250708063551+0c9f909b7976-1~exp1~20250708183702.136), Debian LLD 20.1.8
patch:          https://syzkaller.appspot.com/x/patch.diff?x=12ebf558580000

Note: testing is done by a robot and is best-effort only.

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

end of thread, other threads:[~2025-12-17  8:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-15 12:30 [syzbot] [net?] [usb?] WARNING in mdiobus_get_phy syzbot
2025-12-17  6:27 ` Forwarded: [PATCH] net: usb: asix: validate PHY address before use syzbot
     [not found] <20251217062735.268052-1-kartikey406@gmail.com>
2025-12-17  8:40 ` [syzbot] [net?] [usb?] WARNING in mdiobus_get_phy syzbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox