KASAN: slab-use-after-free Read in uea_upload_pre_firmware
Subsystems (5)
syzbot
syzbotHello,
syzbot found the following issue on:
HEAD commit: 3d5670d672ae Add linux-next specific files for 20260626 git tree: linux-next console output: https://syzkaller.appspot.com/x/log.txt?x=10b76dfe580000 kernel config: https://syzkaller.appspot.com/x/.config?x=2bb8183b2d472f18 dashboard link: https://syzkaller.appspot.com/bug?extid=3d45d763d18796f97412 compiler: Debian clang version 22.1.8 (++20260613092233+e80beda6e255-1~exp1~20260613092250.77), Debian LLD 22.1.8 syz repro: https://syzkaller.appspot.com/x/repro.syz?x=15fa0e1c580000 C reproducer: https://syzkaller.appspot.com/x/repro.c?x=13519391580000
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/a96151aa0055/disk-3d5670d6.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/cdb70a1a6c6c/vmlinux-3d5670d6.xz
kernel image: https://storage.googleapis.com/syzbot-assets/3ffb9df12cc1/bzImage-3d5670d6.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
==================================================================
BUG: KASAN: slab-use-after-free in __intf_to_usbdev include/linux/usb.h:752 [inline]
BUG: KASAN: slab-use-after-free in uea_upload_pre_firmware+0x8d/0x640 drivers/usb/atm/ueagle-atm.c:598
Read of size 8 at addr ffff88802b0710b8 by task kworker/0:2/1664
CPU: 0 UID: 0 PID: 1664 Comm: kworker/0:2 Not tainted syzkaller #0 PREEMPT_{RT,(full)}
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/09/2026
Workqueue: events request_firmware_work_func
Call Trace:
<TASK>
dump_stack_lvl+0xe8/0x150 lib/dump_stack.c:120
print_address_description+0x55/0x1e0 mm/kasan/report.c:378
print_report+0x58/0x70 mm/kasan/report.c:482
kasan_report+0x117/0x150 mm/kasan/report.c:595
__intf_to_usbdev include/linux/usb.h:752 [inline]
uea_upload_pre_firmware+0x8d/0x640 drivers/usb/atm/ueagle-atm.c:598
request_firmware_work_func+0xf7/0x2d0 drivers/base/firmware_loader/main.c:1164
process_one_work+0x93a/0x12b0 kernel/workqueue.c:3326
process_scheduled_works kernel/workqueue.c:3409 [inline]
worker_thread+0xb05/0x10d0 kernel/workqueue.c:3490
kthread+0x388/0x470 kernel/kthread.c:436
ret_from_fork+0x514/0xb70 arch/x86/kernel/process.c:158
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
</TASK>
Allocated by task 5937:
kasan_save_stack mm/kasan/common.c:57 [inline]
kasan_save_track+0x3e/0x80 mm/kasan/common.c:78
poison_kmalloc_redzone mm/kasan/common.c:398 [inline]
__kasan_kmalloc+0x93/0xb0 mm/kasan/common.c:415
kasan_kmalloc include/linux/kasan.h:263 [inline]
__kmalloc_cache_noprof+0x3d2/0x6b0 mm/slub.c:5515
_kmalloc_noprof include/linux/slab.h:969 [inline]
_kzalloc_noprof include/linux/slab.h:1290 [inline]
usb_set_configuration+0x3cc/0x2180 drivers/usb/core/message.c:2096
usb_generic_driver_probe+0x8d/0x150 drivers/usb/core/generic.c:250
usb_probe_device+0x1c3/0x3b0 drivers/usb/core/driver.c:291
call_driver_probe drivers/base/dd.c:-1 [inline]
really_probe+0x254/0xae0 drivers/base/dd.c:706
__driver_probe_device+0x1e8/0x360 drivers/base/dd.c:868
driver_probe_device+0x4f/0x240 drivers/base/dd.c:898
__device_attach_driver+0x270/0x410 drivers/base/dd.c:1026
bus_for_each_drv+0x25b/0x2f0 drivers/base/bus.c:500
__device_attach+0x2c7/0x450 drivers/base/dd.c:1098
device_initial_probe+0xa1/0xd0 drivers/base/dd.c:1153
bus_probe_device+0x12d/0x220 drivers/base/bus.c:620
device_add+0x7d7/0xb80 drivers/base/core.c:3772
usb_new_device+0x98d/0x1610 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+0x28cf/0x4cf0 drivers/usb/core/hub.c:5953---
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 [email protected].
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
syzbotForwarded: [PATCH] usb: atm: ueagle: fix use-after-free in uea_upload_pre_firmware()
For archival purposes, forwarding an incoming command email to [email protected], [email protected].
For archival purposes, forwarding an incoming command email to [email protected], [email protected].
***
Subject: [PATCH] usb: atm: ueagle: fix use-after-free in uea_upload_pre_firmware()
Author: [email protected]
#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
uea_load_firmware() calls request_firmware_nowait() passing a raw struct usb_device pointer as the callback context, without holding a reference to it.
If the USB device is disconnected before the firmware workqueue fires, the usb_device is freed while uea_upload_pre_firmware() is still executing, causing a slab-use-after-free:
BUG: KASAN: slab-use-after-free in __intf_to_usbdev include/linux/usb.h:752 [inline] BUG: KASAN: slab-use-after-free in uea_upload_pre_firmware+0x8d/0x640 drivers/usb/atm/ueagle-atm.c:598 Read of size 8 at addr ffff88802b0710b8 by task kworker/0:2/1664
The root cause: Eagle ADSL modems enumerate twice. On first plug-in they present a pre-firmware PID; uea_probe() calls uea_load_firmware() which queues the firmware upload asynchronously and returns immediately. The USB core considers probing complete. If the cable is pulled at this point, the usb_device is torn down while the firmware callback is still pending or running on the workqueue.
Fix by calling usb_get_dev() before queuing the request to pin the usb_device in memory for the lifetime of the async operation, and usb_put_dev() in the callback once it is finished with the pointer. On the error path where request_firmware_nowait() itself fails, drop the reference immediately since the callback will never fire.
--- drivers/usb/atm/ueagle-atm.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/usb/atm/ueagle-atm.c +5 -2
@@ -663,6 +663,7 @@ static void uea_upload_pre_firmware(const struct firmware *fw_entry,uea_err (usb,"firmware is corrupted\n" ); err:release_firmware (fw_entry); +usb_put_dev (usb); }/*
@@ -693,12 +694,14 @@ static int uea_load_firmware(struct usb_device *usb, unsigned int ver)break ; } +usb_get_dev (usb); ret =request_firmware_nowait (THIS_MODULE ,1 , fw_name, &usb->dev,GFP_KERNEL , usb, uea_upload_pre_firmware); -if (ret) +if (ret) {uea_err (usb,"firmware %s is not available\n" , fw_name); -else +usb_put_dev (usb); + }else uea_info (usb,"loading firmware %s\n" , fw_name);return ret;
Signature · 1 line
2.43.0
PATCH 1/1 usb: atm: ueagle-atm: fix use-after-free in uea_upload_pre_firmware
In reply to syzbotsyzbot reported a slab-use-after-free read in uea_upload_pre_firmware. This is because the usb_device is passed as context to request_firmware_nowait but its reference count is not incremented. Thus, if the USB device is disconnected before the firmware load completes, the callback accesses a freed usb_device.
Fix this by taking a reference with usb_get_dev() before calling request_firmware_nowait() and releasing it with usb_put_dev() in the completion callback or if the request fails to start.
--- drivers/usb/atm/ueagle-atm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/usb/atm/ueagle-atm.c +6 -2
@@ -663,6 +663,7 @@ static void uea_upload_pre_firmware(const struct firmware *fw_entry,uea_err (usb,"firmware is corrupted\n" ); err:release_firmware (fw_entry); +usb_put_dev (usb); }/*
@@ -693,13 +694,16 @@ static int uea_load_firmware(struct usb_device *usb, unsigned int ver)break ; } +usb_get_dev (usb); ret =request_firmware_nowait (THIS_MODULE ,1 , fw_name, &usb->dev,GFP_KERNEL , usb, uea_upload_pre_firmware); -if (ret) +if (ret) {uea_err (usb,"firmware %s is not available\n" , fw_name); -else +usb_put_dev (usb); + }else {uea_info (usb,"loading firmware %s\n" , fw_name); + }return ret; }
Signature · 1 line
2.46.0.windows.1
Quoted 5 lines
Date: Mon, 29 Jun 2026 14:09:27 -0700
Hello,syzbot found the following issue on:
Quoted 8 lines
HEAD commit: 3d5670d672ae Add linux-next specific files for 20260626 git tree: linux-next console output: https://syzkaller.appspot.com/x/log.txt?x=10b76dfe580000 kernel config: https://syzkaller.appspot.com/x/.config?x=2bb8183b2d472f18 dashboard link: https://syzkaller.appspot.com/bug?extid=3d45d763d18796f97412 compiler: Debian clang version 22.1.8 (++20260613092233+e80beda6e255-1~exp1~20260613092250.77), Debian LLD 22.1.8 syz repro: https://syzkaller.appspot.com/x/repro.syz?x=15fa0e1c580000 C reproducer: https://syzkaller.appspot.com/x/repro.c?x=13519391580000
#syz test
drivers/usb/atm/ueagle-atm.c +3 -1
@@ -2605,9 +2605,11 @@ static void uea_disconnect(struct usb_inusbatm_usb_disconnect (intf);mutex_unlock (&uea_mutex);uea_info (usb,"ADSL device removed\n" ); - }else if (usb->config->desc.bNumInterfaces ==1 ) { + }else {struct completion *fw_done =usb_get_intfdata (intf); +if (!fw_done) +return ;uea_dbg (usb,"pre-firmware device, waiting firmware upload\n" );wait_for_completion (fw_done);uea_dbg (usb,"pre-firmware device, finished waiting\n" );
--
syzbot
syzbotsyzbot has tested the proposed patch but the reproducer is still triggering an issue: lost connection to test machine
Hello,
syzbot has tested the proposed patch but the reproducer is still triggering an issue:
lost connection to test machine
Tested on:
commit: bee763d5 Add linux-next specific files for 20260710 git tree: linux-next console output: https://syzkaller.appspot.com/x/log.txt?x=11c85346580000 kernel config: https://syzkaller.appspot.com/x/.config?x=a018aaa0e95afeef dashboard link: https://syzkaller.appspot.com/bug?extid=3d45d763d18796f97412 compiler: Debian clang version 22.1.8 (++20260613092233+e80beda6e255-1~exp1~20260613092250.77), Debian LLD 22.1.8 patch: https://syzkaller.appspot.com/x/patch.diff?x=107b70b9580000