[syzbot] [usb?] BUG: unable to handle kernel NULL pointer dereference in usb_reinit

4 views
Skip to first unread message

syzbot

unread,
4:03 AM (11 hours ago) 4:03 AM
to gre...@linuxfoundation.org, linux-...@vger.kernel.org, linu...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 21d6ac051080 Merge branch 'for-next/core' into for-kernelci
git tree: git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci
console output: https://syzkaller.appspot.com/x/log.txt?x=17603a79580000
kernel config: https://syzkaller.appspot.com/x/.config?x=d1128bc53f2ef7f3
dashboard link: https://syzkaller.appspot.com/bug?extid=2ec7fc1793a63864d9d6
compiler: Debian clang version 22.1.8 (++20260613092233+e80beda6e255-1~exp1~20260613092250.77), Debian LLD 22.1.8
userspace arch: arm64
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1177ea25580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=10e03a79580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/88380e2ddcb9/disk-21d6ac05.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/5dba5c2896b7/vmlinux-21d6ac05.xz
kernel image: https://storage.googleapis.com/syzbot-assets/52ac739e37e0/Image-21d6ac05.gz.xz

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

EXT4-fs (nvme0n1p2): shut down requested (2)
Aborting journal on device nvme0n1p2-8.
Unable to handle kernel NULL poin
Unable to handle kernel NULL pointer dereference at virtual address 0000000000000048
Mem abort info:
ESR = 0x0000000096000006
EC = 0x25: DABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
FSC = 0x06: level 2 translation fault
Data abort info:
ISV = 0, ISS = 0x00000006, ISS2 = 0x00000000
CM = 0, WnR = 0, TnD = 0, TagAccess = 0
GCS = 0, Overlay = 0, DirtyBit = 0
user pgtable: 4k pages, 48-bit VAs, pgdp=00000001166e6000
[0000000000000048] pgd=080000011da38403, p4d=080000011da38403, pud=080000011da3a403, pmd=0000000000000000
Internal error: Oops: 0000000096000006 [#1] SMP
Modules linked in:
CPU: 0 UID: 0 PID: 4939 Comm: syz.0.17 Not tainted syzkaller #0 PREEMPT
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/07/2026
pstate: 83400005 (Nzcv daif +PAN -UAO +TCO +DIT -SSBS BTYPE=--)
pc : __raw_readl arch/arm64/include/asm/io.h:84 [inline]
pc : readl include/asm-generic/io.h:231 [inline]
pc : usb_reinit_338x drivers/usb/gadget/udc/net2280.c:2243 [inline]
pc : usb_reinit+0xbf4/0xfa0 drivers/usb/gadget/udc/net2280.c:2305
lr : usb_reinit_338x drivers/usb/gadget/udc/net2280.c:2236 [inline]
lr : usb_reinit+0xb6c/0xfa0 drivers/usb/gadget/udc/net2280.c:2305
sp : ffff800096ac75a0
x29: ffff800096ac75e0 x28: dfff800000000000 x27: ffff800087354e38
x26: ffff800087354e80 x25: 0000000000000060 x24: 1fffe0001a4fd183
x23: ffff0000d27e8c18 x22: 1fffe0001a4fd00b x21: 0000000000000011
x20: ffff0000d27e8058 x19: ffff0000d27e8000 x18: 00000000ffffffff
x17: ffff80008a7d6000 x16: 0000000000000004 x15: ffff80008a35fda0
x14: ffff80008a5d5e28 x13: 0000000000000001 x12: 0000000000000000
x11: 1fffe0001a4fd178 x10: 0000000000000003 x9 : 0000000000000000
x8 : 0000000000000048 x7 : ffff800080aa1cb8 x6 : 0000000000000000
x5 : 0000000000000000 x4 : 0000000000000001 x3 : ffff8000835bf6bc
x2 : 0000000000000000 x1 : ffff0000cd3d1d40 x0 : 0000000000000000
Call trace:
__raw_readl arch/arm64/include/asm/io.h:84 [inline] (P)
readl include/asm-generic/io.h:231 [inline] (P)
usb_reinit_338x drivers/usb/gadget/udc/net2280.c:2243 [inline] (P)
usb_reinit+0xbf4/0xfa0 drivers/usb/gadget/udc/net2280.c:2305 (P)
net2280_probe+0x5f4/0xef0 drivers/usb/gadget/udc/net2280.c:3712
local_pci_probe+0xc8/0x158 drivers/pci/pci-driver.c:332
pci_call_probe drivers/pci/pci-driver.c:394 [inline]
__pci_device_probe drivers/pci/pci-driver.c:455 [inline]
pci_device_probe+0x460/0x8d4 drivers/pci/pci-driver.c:489
call_driver_probe drivers/base/dd.c:-1 [inline]
really_probe+0x29c/0x800 drivers/base/dd.c:706
__driver_probe_device+0x1e0/0x350 drivers/base/dd.c:868
device_driver_attach+0x58/0xac drivers/base/dd.c:1203
bind_store+0xf4/0x14c drivers/base/bus.c:267
drv_attr_store+0x80/0xa4 drivers/base/bus.c:125
sysfs_kf_write+0xe0/0x108 fs/sysfs/file.c:145
kernfs_fop_write_iter+0x260/0x3b8 fs/kernfs/file.c:345
new_sync_write fs/read_write.c:595 [inline]
vfs_write+0x51c/0xa0c fs/read_write.c:687
ksys_write+0x12c/0x228 fs/read_write.c:739
__do_sys_write fs/read_write.c:750 [inline]
__se_sys_write fs/read_write.c:747 [inline]
__arm64_sys_write+0x84/0x98 fs/read_write.c:747
__invoke_syscall arch/arm64/kernel/syscall.c:35 [inline]
invoke_syscall+0x98/0x244 arch/arm64/kernel/syscall.c:49
el0_svc_common+0xec/0x23c arch/arm64/kernel/syscall.c:121
do_el0_svc+0x4c/0x5c arch/arm64/kernel/syscall.c:140
el0_svc+0x64/0x260 arch/arm64/kernel/entry-common.c:758
el0t_64_sync_handler+0x44/0x104 arch/arm64/kernel/entry-common.c:777
el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:590
Code: 9757676c f94002e8 91012108 d503201f (b9400115)
---[ end trace 0000000000000000 ]---
----------------
Code disassembly (best guess):
0: 9757676c bl 0xfffffffffd5d9db0
4: f94002e8 ldr x8, [x23]
8: 91012108 add x8, x8, #0x48
c: d503201f nop
* 10: b9400115 ldr w21, [x8] <-- trapping instruction


---
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 syzk...@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

syzbot

unread,
7:23 AM (8 hours ago) 7:23 AM
to linux-...@vger.kernel.org, syzkall...@googlegroups.com
For archival purposes, forwarding an incoming command email to
linux-...@vger.kernel.org, syzkall...@googlegroups.com.

***

Subject: [PATCH] usb: gadget: net2280: fix NULL pointer deref in usb_reinit_338x()
Author: karti...@gmail.com

#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci

net2280_probe() only maps dev->llregs when the PLX_PCIE quirk bit is
set. usb_reinit() dispatches to usb_reinit_338x() for any device that
doesn't have PLX_LEGACY set, assuming such a device must have
PLX_PCIE set (and thus llregs mapped). That assumption holds for
every entry in the driver's pci_device_id table, but a forced driver
bind (e.g. via sysfs bind/driver_override) can invoke probe() with
quirks that have neither bit set, leaving llregs NULL and crashing
in usb_reinit_338x() on the first readl().

Reject probe() early when quirks has neither PLX_LEGACY nor
PLX_PCIE set, instead of proceeding into a reinit path that assumes
one of them is always present.

Reported-by: syzbot+2ec7fc...@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=2ec7fc1793a63864d9d6
Signed-off-by: Deepanshu Kartikey <karti...@gmail.com>
---
drivers/usb/gadget/udc/net2280.c | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/drivers/usb/gadget/udc/net2280.c b/drivers/usb/gadget/udc/net2280.c
index 7c5f30cfd24d..02d12c2ad58b 100644
--- a/drivers/usb/gadget/udc/net2280.c
+++ b/drivers/usb/gadget/udc/net2280.c
@@ -3708,6 +3708,17 @@ static int net2280_probe(struct pci_dev *pdev, const struct pci_device_id *id)
writel(0, &dev->usb->usbctl);
}

+ /* usb_reinit() dispatches on PLX_LEGACY vs PLX_PCIE and assumes
+ * every non-legacy chip has llregs mapped (PLX_PCIE branch above).
+ * A forced/mismatched driver bind can hand us quirks that satisfy
+ * neither, so refuse to proceed rather than dereference NULL.
+ */
+ if (!(dev->quirks & (PLX_LEGACY | PLX_PCIE))) {
+ ep_err(dev, "unsupported device (quirks=%#lx)\n", dev->quirks);
+ retval = -ENODEV;
+ goto done;
+ }
+
usb_reset(dev);
usb_reinit(dev);

--
2.43.0

syzbot

unread,
7:54 AM (7 hours ago) 7:54 AM
to karti...@gmail.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
SYZFAIL: posix_spawnp failed

SYZFAIL: posix_spawnp failed
(errno 5: Input/output error)
connection error: failed to recv *flatrpc.ExecutorMessageRawT: read tcp 127.0.0.1:44127->127.0.0.1:33802: read: connection reset by peer


Tested on:

commit: 21d6ac05 Merge branch 'for-next/core' into for-kernelci
console output: https://syzkaller.appspot.com/x/log.txt?x=15083e79580000
kernel config: https://syzkaller.appspot.com/x/.config?x=d1128bc53f2ef7f3
dashboard link: https://syzkaller.appspot.com/bug?extid=2ec7fc1793a63864d9d6
compiler: Debian clang version 22.1.8 (++20260613092233+e80beda6e255-1~exp1~20260613092250.77), Debian LLD 22.1.8
userspace arch: arm64
patch: https://syzkaller.appspot.com/x/patch.diff?x=173a9e79580000

Reply all
Reply to author
Forward
0 new messages