* [syzbot] [usb?] KASAN: slab-use-after-free Write in keyspan_close
@ 2026-08-30 15:03 syzbot
2026-08-30 23:50 ` Edward Adam Davis
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: syzbot @ 2026-08-30 15:03 UTC (permalink / raw)
To: gregkh, johan, linux-kernel, linux-usb, syzkaller-bugs
Hello,
syzbot found the following issue on:
HEAD commit: 08dbfad3f504 Merge tag 'for-linus' of git://git.kernel.org..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1731ac15580000
kernel config: https://syzkaller.appspot.com/x/.config?x=8c5c3949d762a91f
dashboard link: https://syzkaller.appspot.com/bug?extid=5fabc1ae99ff40690d84
compiler: gcc (Debian 14.2.0-19) 14.2.0, GNU ld (GNU Binutils for Debian) 2.44
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=15677d79580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=108ffd49580000
Downloadable assets:
disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/d900f083ada3/non_bootable_disk-08dbfad3.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/1b5cf3bd2698/vmlinux-08dbfad3.xz
kernel image: https://storage.googleapis.com/syzbot-assets/05ad56c0b8bc/bzImage-08dbfad3.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+5fabc1ae99ff40690d84@syzkaller.appspotmail.com
==================================================================
BU
BUG: KASAN: slab-use-after-free in keyspan_close+0x23e/0x260 drivers/usb/serial/keyspan.c:1594
Write of size 4 at addr ffff888028051104 by task syz.2.29/6038
CPU: 1 UID: 0 PID: 6038 Comm: syz.2.29 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120
print_address_description mm/kasan/report.c:378 [inline]
print_report+0x13d/0x4b0 mm/kasan/report.c:482
kasan_report+0xdf/0x1c0 mm/kasan/report.c:595
keyspan_close+0x23e/0x260 drivers/usb/serial/keyspan.c:1594
serial_port_shutdown+0x92/0x110 drivers/usb/serial/usb-serial.c:306
tty_port_shutdown+0x1fa/0x250 drivers/tty/tty_port.c:372
tty_port_hangup+0xfb/0x160 drivers/tty/tty_port.c:397
__tty_hangup.part.0+0x696/0x7c0 drivers/tty/tty_io.c:644
__tty_hangup drivers/tty/tty_io.c:688 [inline]
tty_vhangup drivers/tty/tty_io.c:691 [inline]
tty_vhangup drivers/tty/tty_io.c:688 [inline]
tty_ioctl+0x112e/0x1640 drivers/tty/tty_io.c:2705
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:597 [inline]
__se_sys_ioctl fs/ioctl.c:583 [inline]
__x64_sys_ioctl+0x18e/0x210 fs/ioctl.c:583
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x123/0x790 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f32c159e159
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffd7a0b3f98 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f32c1825fa0 RCX: 00007f32c159e159
RDX: 0000000000000000 RSI: 0000000000005437 RDI: 0000000000000004
RBP: 00007f32c1635024 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f32c1825fac R14: 00007f32c1825fa0 R15: 00007f32c1825fa0
</TASK>
Allocated by task 991:
kasan_save_stack+0x30/0x50 mm/kasan/common.c:57
kasan_save_track+0x14/0x30 mm/kasan/common.c:78
poison_kmalloc_redzone mm/kasan/common.c:398 [inline]
__kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:415
kasan_kmalloc include/linux/kasan.h:263 [inline]
__kmalloc_cache_noprof+0x2f8/0x6d0 mm/slub.c:5563
_kmalloc_noprof include/linux/slab.h:991 [inline]
_kzalloc_noprof include/linux/slab.h:1312 [inline]
keyspan_port_probe+0xbc/0xdd0 drivers/usb/serial/keyspan.c:2891
usb_serial_device_probe+0x106/0x3e0 drivers/usb/serial/bus.c:47
call_driver_probe drivers/base/dd.c:628 [inline]
really_probe+0x241/0xa60 drivers/base/dd.c:706
__driver_probe_device+0x210/0x460 drivers/base/dd.c:868
driver_probe_device+0x4a/0x140 drivers/base/dd.c:898
__device_attach_driver+0x1df/0x320 drivers/base/dd.c:1026
bus_for_each_drv+0x159/0x1e0 drivers/base/bus.c:500
__device_attach+0x1e4/0x4d0 drivers/base/dd.c:1098
device_initial_probe+0xaf/0xd0 drivers/base/dd.c:1153
bus_probe_device+0x64/0x160 drivers/base/bus.c:620
device_add+0x121d/0x1970 drivers/base/core.c:3776
usb_serial_probe.cold+0x257e/0x29f8 drivers/usb/serial/usb-serial.c:1147
usb_probe_interface+0x386/0x9b0 drivers/usb/core/driver.c:399
call_driver_probe drivers/base/dd.c:628 [inline]
really_probe+0x241/0xa60 drivers/base/dd.c:706
__driver_probe_device+0x210/0x460 drivers/base/dd.c:868
driver_probe_device+0x4a/0x140 drivers/base/dd.c:898
__device_attach_driver+0x1df/0x320 drivers/base/dd.c:1026
bus_for_each_drv+0x159/0x1e0 drivers/base/bus.c:500
__device_attach+0x1e4/0x4d0 drivers/base/dd.c:1098
device_initial_probe+0xaf/0xd0 drivers/base/dd.c:1153
bus_probe_device+0x64/0x160 drivers/base/bus.c:620
device_add+0x121d/0x1970 drivers/base/core.c:3776
usb_set_configuration+0xd97/0x1c60 drivers/usb/core/message.c:2268
usb_generic_driver_probe+0xa1/0xe0 drivers/usb/core/generic.c:250
usb_probe_device+0xef/0x400 drivers/usb/core/driver.c:293
call_driver_probe drivers/base/dd.c:628 [inline]
really_probe+0x241/0xa60 drivers/base/dd.c:706
__driver_probe_device+0x210/0x460 drivers/base/dd.c:868
driver_probe_device+0x4a/0x140 drivers/base/dd.c:898
__device_attach_driver+0x1df/0x320 drivers/base/dd.c:1026
bus_for_each_drv+0x159/0x1e0 drivers/base/bus.c:500
__device_attach+0x1e4/0x4d0 drivers/base/dd.c:1098
device_initial_probe+0xaf/0xd0 drivers/base/dd.c:1153
bus_probe_device+0x64/0x160 drivers/base/bus.c:620
device_add+0x121d/0x1970 drivers/base/core.c:3776
usb_new_device.part.0+0xcc2/0x1686 drivers/usb/core/hub.c:2708
usb_new_device include/linux/workqueue.h:715 [inline]
hub_port_connect drivers/usb/core/hub.c:5580 [inline]
hub_port_connect_change drivers/usb/core/hub.c:5720 [inline]
port_event drivers/usb/core/hub.c:5884 [inline]
hub_event.cold+0x1e3/0xe90 drivers/usb/core/hub.c:5966
process_one_work+0xac7/0x1b10 kernel/workqueue.c:3387
process_scheduled_works kernel/workqueue.c:3470 [inline]
worker_thread+0x5ef/0xe50 kernel/workqueue.c:3551
kthread+0x373/0x450 kernel/kthread.c:436
ret_from_fork+0x730/0xd60 arch/x86/kernel/process.c:158
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
Freed by task 58:
kasan_save_stack+0x30/0x50 mm/kasan/common.c:57
kasan_save_track+0x14/0x30 mm/kasan/common.c:78
kasan_save_free_info+0x3b/0x70 mm/kasan/generic.c:584
poison_slab_object mm/kasan/common.c:253 [inline]
__kasan_slab_free+0x5f/0x80 mm/kasan/common.c:285
kasan_slab_free include/linux/kasan.h:235 [inline]
slab_free_hook mm/slub.c:2748 [inline]
slab_free mm/slub.c:6499 [inline]
kfree+0x22b/0x6d0 mm/slub.c:6792
usb_serial_device_remove+0x146/0x1a0 drivers/usb/serial/bus.c:97
device_remove+0xcb/0x180 drivers/base/dd.c:616
__device_release_driver drivers/base/dd.c:1349 [inline]
device_release_driver_internal+0x44e/0x620 drivers/base/dd.c:1372
bus_remove_device+0x2bc/0x560 drivers/base/bus.c:664
device_del+0x376/0x9b0 drivers/base/core.c:3965
usb_serial_disconnect+0x21e/0x490 drivers/usb/serial/usb-serial.c:1195
usb_unbind_interface+0x1dd/0x9e0 drivers/usb/core/driver.c:461
device_remove drivers/base/dd.c:618 [inline]
device_remove+0x12a/0x180 drivers/base/dd.c:610
__device_release_driver drivers/base/dd.c:1349 [inline]
device_release_driver_internal+0x44e/0x620 drivers/base/dd.c:1372
bus_remove_device+0x2bc/0x560 drivers/base/bus.c:664
device_del+0x376/0x9b0 drivers/base/core.c:3965
usb_disable_device+0x367/0x810 drivers/usb/core/message.c:1478
usb_disconnect+0x2e2/0x9a0 drivers/usb/core/hub.c:2350
hub_port_connect drivers/usb/core/hub.c:5420 [inline]
hub_port_connect_change drivers/usb/core/hub.c:5720 [inline]
port_event drivers/usb/core/hub.c:5884 [inline]
hub_event+0x1bb1/0x4420 drivers/usb/core/hub.c:5966
process_one_work+0xac7/0x1b10 kernel/workqueue.c:3387
process_scheduled_works kernel/workqueue.c:3470 [inline]
worker_thread+0x5ef/0xe50 kernel/workqueue.c:3551
kthread+0x373/0x450 kernel/kthread.c:436
ret_from_fork+0x730/0xd60 arch/x86/kernel/process.c:158
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245
The buggy address belongs to the object at ffff888028051100
which belongs to the cache kmalloc-192 of size 192
The buggy address is located 4 bytes inside of
freed 192-byte region [ffff888028051100, ffff8880280511c0)
The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x28051
flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 00fff00000000000 ffff88801c0423c0 dead000000000100 dead000000000122
raw: 0000000000000000 0000000000100010 00000000f5000000 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0xd2cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 1, tgid 1 (swapper/0), ts 5549223145
set_page_owner include/linux/page_owner.h:33 [inline]
post_alloc_hook+0xfd/0x120 mm/page_alloc.c:1871
prep_new_page mm/page_alloc.c:1879 [inline]
get_page_from_freelist+0x110d/0x35b0 mm/page_alloc.c:3943
__alloc_frozen_pages_noprof+0x2eb/0x3300 mm/page_alloc.c:5436
alloc_slab_page mm/slub.c:3347 [inline]
allocate_slab mm/slub.c:3462 [inline]
new_slab+0xa9/0x6e0 mm/slub.c:3513
refill_objects+0xe3/0x410 mm/slub.c:7410
refill_sheaf mm/slub.c:2885 [inline]
__pcs_replace_empty_main+0x35e/0x650 mm/slub.c:4774
alloc_from_pcs mm/slub.c:4850 [inline]
slab_alloc_node mm/slub.c:4984 [inline]
__kmalloc_cache_noprof+0x4f4/0x6d0 mm/slub.c:5559
_kmalloc_noprof include/linux/slab.h:991 [inline]
_kzalloc_noprof include/linux/slab.h:1312 [inline]
call_usermodehelper_setup+0xaf/0x360 kernel/umh.c:360
kobject_uevent_env+0x17c1/0x18b0 lib/kobject_uevent.c:631
__kobject_del+0x168/0x220 lib/kobject.c:601
kobject_cleanup lib/kobject.c:680 [inline]
kobject_release lib/kobject.c:720 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x348/0x640 lib/kobject.c:737
bus_remove_driver+0x16e/0x2e0 drivers/base/bus.c:834
driver_unregister+0x76/0xb0 drivers/base/driver.c:202
pci_unregister_driver+0x2a/0x220 drivers/pci/pci-driver.c:1519
agp_amd64_init+0x174/0x2c0 drivers/char/agp/amd64-agp.c:761
do_one_initcall+0x11c/0x6f0 init/main.c:1357
page_owner free stack trace missing
Memory state around the buggy address:
ffff888028051000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff888028051080: 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888028051100: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888028051180: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff888028051200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================
---
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] 7+ messages in thread
* Re: [syzbot] [usb?] KASAN: slab-use-after-free Write in keyspan_close
2026-08-30 15:03 [syzbot] [usb?] KASAN: slab-use-after-free Write in keyspan_close syzbot
@ 2026-08-30 23:50 ` Edward Adam Davis
2026-08-31 0:14 ` syzbot
2026-08-31 0:10 ` Forwarded: [PATCH] USB: serial: keyspan: fix use-after-free " syzbot
2026-08-31 0:38 ` [syzbot] [usb?] KASAN: slab-use-after-free Write " Edward Adam Davis
2 siblings, 1 reply; 7+ messages in thread
From: Edward Adam Davis @ 2026-08-30 23:50 UTC (permalink / raw)
To: syzbot+5fabc1ae99ff40690d84; +Cc: linux-kernel, syzkaller-bugs
From: Edward Aadm Davis <eadavis@sina.com>
#syz test: upstream 08dbfad3f504
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 17edc057a311..51359815432a 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -301,11 +301,19 @@ static void serial_port_shutdown(struct tty_port *tport)
struct usb_serial_port *port =
container_of(tport, struct usb_serial_port, port);
struct usb_serial_driver *drv = port->serial->type;
+ struct usb_serial *serial = port->serial;
+
+ mutex_lock(&serial->disc_mutex);
+ if (serial->disconnected) {
+ mutex_unlock(&serial->disc_mutex);
+ return;
+ }
if (drv->close)
drv->close(port);
usb_autopm_put_interface(port->serial->interface);
+ mutex_unlock(&serial->disc_mutex);
}
static void serial_hangup(struct tty_struct *tty)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Forwarded: [PATCH] USB: serial: keyspan: fix use-after-free in keyspan_close
2026-08-30 15:03 [syzbot] [usb?] KASAN: slab-use-after-free Write in keyspan_close syzbot
2026-08-30 23:50 ` Edward Adam Davis
@ 2026-08-31 0:10 ` syzbot
2026-08-31 0:38 ` [syzbot] [usb?] KASAN: slab-use-after-free Write " Edward Adam Davis
2 siblings, 0 replies; 7+ messages in thread
From: syzbot @ 2026-08-31 0:10 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] USB: serial: keyspan: fix use-after-free in keyspan_close
Author: kartikey406@gmail.com
#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
keyspan_port_remove() frees the port's private data (p_priv) while
keyspan_close() may still be running concurrently on another task,
e.g. triggered by an explicit TIOCVHANGUP ioctl on an already-open
tty racing with device disconnect. This results in keyspan_close()
dereferencing freed memory.
Fix this by adding a mutex to keyspan_serial_private that serializes
keyspan_close() against keyspan_port_remove(): the latter clears the
port's private data pointer under the lock before freeing it, and
the former re-fetches and checks that pointer under the same lock
before use.
Reported-by: syzbot+5fabc1ae99ff40690d84@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=5fabc1ae99ff40690d84
Signed-off-by: Deepanshu Kartikey <kartikey406@gmail.com>
---
drivers/usb/serial/keyspan.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c
index 4d3746c7a94e..623f15b51a6a 100644
--- a/drivers/usb/serial/keyspan.c
+++ b/drivers/usb/serial/keyspan.c
@@ -541,6 +541,7 @@ struct keyspan_serial_private {
struct urb *glocont_urb;
char *glocont_buf;
char *ctrl_buf; /* for EP0 control message */
+ struct mutex lock; /* protects p_priv vs port_remove races */
};
struct keyspan_port_private {
@@ -1581,8 +1582,15 @@ static void keyspan_close(struct usb_serial_port *port)
{
int i;
struct keyspan_port_private *p_priv;
+ struct keyspan_serial_private *s_priv = usb_get_serial_data(port->serial);
+ mutex_lock(&s_priv->lock);
p_priv = usb_get_serial_port_data(port);
+ if (!p_priv) {
+ /* port_remove() already ran and freed this */
+ mutex_unlock(&s_priv->lock);
+ return ;
+ }
p_priv->rts_state = 0;
p_priv->dtr_state = 0;
@@ -1599,6 +1607,7 @@ static void keyspan_close(struct usb_serial_port *port)
usb_kill_urb(p_priv->in_urbs[i]);
usb_kill_urb(p_priv->out_urbs[i]);
}
+ mutex_unlock(&s_priv->lock);
}
/* download the firmware to a pre-renumeration device */
@@ -2794,7 +2803,7 @@ static int keyspan_startup(struct usb_serial *serial)
s_priv = kzalloc_obj(struct keyspan_serial_private);
if (!s_priv)
return -ENOMEM;
-
+ mutex_init(&s_priv->lock);
s_priv->instat_buf = kzalloc(INSTAT_BUFLEN, GFP_KERNEL);
if (!s_priv->instat_buf)
goto err_instat_buf;
@@ -2971,10 +2980,14 @@ static int keyspan_port_probe(struct usb_serial_port *port)
static void keyspan_port_remove(struct usb_serial_port *port)
{
+ struct keyspan_serial_private *s_priv = usb_get_serial_data(port->serial);
struct keyspan_port_private *p_priv;
int i;
+ mutex_lock(&s_priv->lock);
p_priv = usb_get_serial_port_data(port);
+ usb_set_serial_port_data(port, NULL);
+ mutex_unlock(&s_priv->lock);
usb_kill_urb(p_priv->inack_urb);
usb_kill_urb(p_priv->outcont_urb);
--
2.43.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [syzbot] [usb?] KASAN: slab-use-after-free Write in keyspan_close
2026-08-30 23:50 ` Edward Adam Davis
@ 2026-08-31 0:14 ` syzbot
0 siblings, 0 replies; 7+ messages in thread
From: syzbot @ 2026-08-31 0:14 UTC (permalink / raw)
To: eadavis, linux-kernel, syzkaller-bugs
Hello,
syzbot has tested the proposed patch but the reproducer is still triggering an issue:
BUG: corrupted list in usb_hcd_link_urb_to_ep
list_add double add: new=ffff888024daf118, prev=ffff888024daf118, next=ffff88802b357078.
------------[ cut here ]------------
kernel BUG at lib/list_debug.c:35!
Oops: invalid opcode: 0000 [#1] SMP KASAN NOPTI
CPU: 0 UID: 0 PID: 7594 Comm: syz.3.536 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
RIP: 0010:__list_add_valid_or_report.cold+0x34/0x36 lib/list_debug.c:35
Code: eb ff 90 0f 0b 48 c7 c7 00 0d 62 8c e8 7a be eb ff 90 0f 0b 48 89 d9 4c 89 ea 48 89 ee 48 c7 c7 40 0f 62 8c e8 62 be eb ff 90 <0f> 0b 48 89 de 48 c7 c7 00 10 62 8c e8 50 be eb ff 90 0f 0b 48 89
RSP: 0018:ffffc900000078b8 EFLAGS: 00010086
RAX: 0000000000000058 RBX: ffff88802b357078 RCX: 0000000000000000
RDX: 0000000000000058 RSI: ffffffff81e9e1d9 RDI: fffff52000000f08
RBP: ffff888024daf118 R08: 0000000000000007 R09: 0000000000000000
R10: 8000000000000102 R11: 0000000000000001 R12: ffff88802b357080
R13: ffff888024daf118 R14: 0000000000000000 R15: ffff888024daf118
FS: 00007f9d428ff6c0(0000) GS:ffff8880d5b64000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fbabb227dac CR3: 000000003d2aa000 CR4: 0000000000352ef0
Call Trace:
<IRQ>
__list_add_valid include/linux/list.h:104 [inline]
__list_add include/linux/list.h:169 [inline]
list_add_tail include/linux/list.h:206 [inline]
usb_hcd_link_urb_to_ep+0x220/0x3a0 drivers/usb/core/hcd.c:1154
dummy_urb_enqueue+0x2b5/0x880 drivers/usb/gadget/udc/dummy_hcd.c:1310
usb_hcd_submit_urb+0x268/0x2150 drivers/usb/core/hcd.c:1542
usb_submit_urb+0x827/0x19b0 drivers/usb/core/urb.c:586
keyspan_usa67_send_setup.isra.0+0x641/0x950 drivers/usb/serial/keyspan.c:2740
usa67_glocont_callback+0x1bb/0x2a0 drivers/usb/serial/keyspan.c:1454
__usb_hcd_giveback_urb+0x38e/0x610 drivers/usb/core/hcd.c:1657
usb_hcd_giveback_urb+0x3ca/0x4a0 drivers/usb/core/hcd.c:1741
dummy_timer+0xdb2/0x3700 drivers/usb/gadget/udc/dummy_hcd.c:2019
__run_hrtimer kernel/time/hrtimer.c:2067 [inline]
__hrtimer_run_queues+0x462/0x9c0 kernel/time/hrtimer.c:2124
hrtimer_run_softirq+0x1ca/0x360 kernel/time/hrtimer.c:2141
handle_softirqs+0x1e6/0x9d0 kernel/softirq.c:645
__do_softirq kernel/softirq.c:679 [inline]
invoke_softirq kernel/softirq.c:519 [inline]
__irq_exit_rcu+0x194/0x210 kernel/softirq.c:767
irq_exit_rcu+0x9/0x30 kernel/softirq.c:784
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
sysvec_apic_timer_interrupt+0xa3/0xc0 arch/x86/kernel/apic/apic.c:1062
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
RIP: 0010:lock_acquire+0x5e/0x380 kernel/locking/lockdep.c:5913
Code: 05 4f a1 a4 12 83 f8 07 0f 87 da 00 00 00 48 0f a3 05 5e d7 5d 0f 0f 82 c9 02 00 00 8b 35 fe 08 5e 0f 85 f6 0f 85 c7 00 00 00 <48> 8b 44 24 30 65 48 2b 05 ed a0 a4 12 0f 85 09 03 00 00 48 83 c4
RSP: 0018:ffffc9000dfbf6f0 EFLAGS: 00000206
RAX: 0000000000000046 RBX: 0000000000000000 RCX: 0000000000000200
RDX: 0000000000000000 RSI: ffffffff8e3c46cc RDI: ffffffff8c620c80
RBP: ffffffff8edec060 R08: 00000000c68d1768 R09: 0000000000000007
R10: 0000000000000200 R11: 0000000000000001 R12: 0000000000000002
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
rcu_lock_acquire include/linux/rcupdate.h:309 [inline]
rcu_read_lock include/linux/rcupdate.h:849 [inline]
class_rcu_constructor include/linux/rcupdate.h:1216 [inline]
unwind_next_frame+0xd1/0x2090 arch/x86/kernel/unwind_orc.c:495
arch_stack_walk+0x94/0xf0 arch/x86/kernel/stacktrace.c:25
stack_trace_save+0x8e/0xc0 kernel/stacktrace.c:122
kasan_save_stack+0x30/0x50 mm/kasan/common.c:57
kasan_save_track+0x14/0x30 mm/kasan/common.c:78
poison_kmalloc_redzone mm/kasan/common.c:398 [inline]
__kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:415
kasan_kmalloc include/linux/kasan.h:263 [inline]
__do_kmalloc_node mm/slub.c:5414 [inline]
__kmalloc_noprof+0x32f/0x840 mm/slub.c:5439
_kmalloc_noprof include/linux/slab.h:995 [inline]
tomoyo_realpath_from_path+0xb6/0x690 security/tomoyo/realpath.c:251
tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
tomoyo_path_number_perm+0x23c/0x580 security/tomoyo/file.c:728
security_file_ioctl+0xd3/0x230 security/security.c:2512
__do_sys_ioctl fs/ioctl.c:591 [inline]
__se_sys_ioctl fs/ioctl.c:583 [inline]
__x64_sys_ioctl+0xb7/0x210 fs/ioctl.c:583
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x123/0x790 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f9d4199e159
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f9d428ff028 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f9d41c25fa0 RCX: 00007f9d4199e159
RDX: 0000000000000000 RSI: 0000000000005437 RDI: 0000000000000004
RBP: 00007f9d41a35024 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f9d41c26038 R14: 00007f9d41c25fa0 R15: 00007ffc0da26608
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:__list_add_valid_or_report.cold+0x34/0x36 lib/list_debug.c:35
Code: eb ff 90 0f 0b 48 c7 c7 00 0d 62 8c e8 7a be eb ff 90 0f 0b 48 89 d9 4c 89 ea 48 89 ee 48 c7 c7 40 0f 62 8c e8 62 be eb ff 90 <0f> 0b 48 89 de 48 c7 c7 00 10 62 8c e8 50 be eb ff 90 0f 0b 48 89
RSP: 0018:ffffc900000078b8 EFLAGS: 00010086
RAX: 0000000000000058 RBX: ffff88802b357078 RCX: 0000000000000000
RDX: 0000000000000058 RSI: ffffffff81e9e1d9 RDI: fffff52000000f08
RBP: ffff888024daf118 R08: 0000000000000007 R09: 0000000000000000
R10: 8000000000000102 R11: 0000000000000001 R12: ffff88802b357080
R13: ffff888024daf118 R14: 0000000000000000 R15: ffff888024daf118
FS: 00007f9d428ff6c0(0000) GS:ffff8880d5b64000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fbabb227dac CR3: 000000003d2aa000 CR4: 0000000000352ef0
----------------
Code disassembly (best guess):
0: 05 4f a1 a4 12 add $0x12a4a14f,%eax
5: 83 f8 07 cmp $0x7,%eax
8: 0f 87 da 00 00 00 ja 0xe8
e: 48 0f a3 05 5e d7 5d bt %rax,0xf5dd75e(%rip) # 0xf5dd774
15: 0f
16: 0f 82 c9 02 00 00 jb 0x2e5
1c: 8b 35 fe 08 5e 0f mov 0xf5e08fe(%rip),%esi # 0xf5e0920
22: 85 f6 test %esi,%esi
24: 0f 85 c7 00 00 00 jne 0xf1
* 2a: 48 8b 44 24 30 mov 0x30(%rsp),%rax <-- trapping instruction
2f: 65 48 2b 05 ed a0 a4 sub %gs:0x12a4a0ed(%rip),%rax # 0x12a4a124
36: 12
37: 0f 85 09 03 00 00 jne 0x346
3d: 48 rex.W
3e: 83 .byte 0x83
3f: c4 .byte 0xc4
Tested on:
commit: 08dbfad3 Merge tag 'for-linus' of git://git.kernel.org..
git tree: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=113a8349580000
kernel config: https://syzkaller.appspot.com/x/.config?x=8c5c3949d762a91f
dashboard link: https://syzkaller.appspot.com/bug?extid=5fabc1ae99ff40690d84
compiler: gcc (Debian 14.2.0-19) 14.2.0, GNU ld (GNU Binutils for Debian) 2.44
patch: https://syzkaller.appspot.com/x/patch.diff?x=14357379580000
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [syzbot] [usb?] KASAN: slab-use-after-free Write in keyspan_close
2026-08-30 15:03 [syzbot] [usb?] KASAN: slab-use-after-free Write in keyspan_close syzbot
2026-08-30 23:50 ` Edward Adam Davis
2026-08-31 0:10 ` Forwarded: [PATCH] USB: serial: keyspan: fix use-after-free " syzbot
@ 2026-08-31 0:38 ` Edward Adam Davis
2026-08-31 1:02 ` syzbot
2 siblings, 1 reply; 7+ messages in thread
From: Edward Adam Davis @ 2026-08-31 0:38 UTC (permalink / raw)
To: syzbot+5fabc1ae99ff40690d84; +Cc: linux-kernel, syzkaller-bugs
From: Edward Aadm Davis <eadavis@sina.com>
#syz test: upstream 08dbfad3f504
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 17edc057a311..0464dbab17c1 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -301,10 +301,19 @@ static void serial_port_shutdown(struct tty_port *tport)
struct usb_serial_port *port =
container_of(tport, struct usb_serial_port, port);
struct usb_serial_driver *drv = port->serial->type;
+ struct usb_serial *serial = port->serial;
+
+ mutex_lock(&serial->disc_mutex);
+ if (serial->disconnected) {
+ mutex_unlock(&serial->disc_mutex);
+ goto out;
+ }
if (drv->close)
drv->close(port);
+ mutex_unlock(&serial->disc_mutex);
+out:
usb_autopm_put_interface(port->serial->interface);
}
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [syzbot] [usb?] KASAN: slab-use-after-free Write in keyspan_close
2026-08-31 0:38 ` [syzbot] [usb?] KASAN: slab-use-after-free Write " Edward Adam Davis
@ 2026-08-31 1:02 ` syzbot
0 siblings, 0 replies; 7+ messages in thread
From: syzbot @ 2026-08-31 1:02 UTC (permalink / raw)
To: eadavis, linux-kernel, syzkaller-bugs
Hello,
syzbot has tested the proposed patch but the reproducer is still triggering an issue:
BUG: corrupted list in usb_hcd_link_urb_to_ep
list_add double add: new=ffff88803dbb4e18, prev=ffff88803dbb4e18, next=ffff888054867878.
------------[ cut here ]------------
kernel BUG at lib/list_debug.c:35!
Oops: invalid opcode: 0000 [#1] SMP KASAN NOPTI
CPU: 2 UID: 0 PID: 8045 Comm: syz.3.731 Not tainted syzkaller #0 PREEMPT(full)
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
RIP: 0010:__list_add_valid_or_report.cold+0x34/0x36 lib/list_debug.c:35
Code: eb ff 90 0f 0b 48 c7 c7 00 0d 62 8c e8 7a be eb ff 90 0f 0b 48 89 d9 4c 89 ea 48 89 ee 48 c7 c7 40 0f 62 8c e8 62 be eb ff 90 <0f> 0b 48 89 de 48 c7 c7 00 10 62 8c e8 50 be eb ff 90 0f 0b 48 89
RSP: 0018:ffffc900006588b8 EFLAGS: 00010086
RAX: 0000000000000058 RBX: ffff888054867878 RCX: 0000000000000000
RDX: 0000000000000058 RSI: ffffffff81e9e1d9 RDI: fffff520000cb108
RBP: ffff88803dbb4e18 R08: 0000000000000007 R09: 0000000000000000
R10: 8000000000000103 R11: 0000000000000001 R12: ffff888054867880
R13: ffff88803dbb4e18 R14: 0000000000000000 R15: ffff88803dbb4e18
FS: 00007ff211c5e6c0(0000) GS:ffff8880d5d64000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f348dc70050 CR3: 000000002dba6000 CR4: 0000000000352ef0
Call Trace:
<IRQ>
__list_add_valid include/linux/list.h:104 [inline]
__list_add include/linux/list.h:169 [inline]
list_add_tail include/linux/list.h:206 [inline]
usb_hcd_link_urb_to_ep+0x220/0x3a0 drivers/usb/core/hcd.c:1154
dummy_urb_enqueue+0x2b5/0x880 drivers/usb/gadget/udc/dummy_hcd.c:1310
usb_hcd_submit_urb+0x268/0x2150 drivers/usb/core/hcd.c:1542
usb_submit_urb+0x827/0x19b0 drivers/usb/core/urb.c:586
keyspan_usa67_send_setup.isra.0+0x641/0x950 drivers/usb/serial/keyspan.c:2740
usa67_glocont_callback+0x1bb/0x2a0 drivers/usb/serial/keyspan.c:1454
__usb_hcd_giveback_urb+0x38e/0x610 drivers/usb/core/hcd.c:1657
usb_hcd_giveback_urb+0x3ca/0x4a0 drivers/usb/core/hcd.c:1741
dummy_timer+0xdb2/0x3700 drivers/usb/gadget/udc/dummy_hcd.c:2019
__run_hrtimer kernel/time/hrtimer.c:2067 [inline]
__hrtimer_run_queues+0x462/0x9c0 kernel/time/hrtimer.c:2124
hrtimer_run_softirq+0x1ca/0x360 kernel/time/hrtimer.c:2141
handle_softirqs+0x1e6/0x9d0 kernel/softirq.c:645
__do_softirq kernel/softirq.c:679 [inline]
invoke_softirq kernel/softirq.c:519 [inline]
__irq_exit_rcu+0x194/0x210 kernel/softirq.c:767
irq_exit_rcu+0x9/0x30 kernel/softirq.c:784
instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1062 [inline]
sysvec_apic_timer_interrupt+0xa3/0xc0 arch/x86/kernel/apic/apic.c:1062
</IRQ>
<TASK>
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
RIP: 0010:owner_on_cpu include/linux/sched.h:2338 [inline]
RIP: 0010:mutex_spin_on_owner+0xbb/0x2b0 kernel/locking/mutex.c:406
Code: 48 89 df e8 d7 f0 98 00 48 89 d8 48 c1 e8 03 42 80 3c 38 00 0f 85 c0 01 00 00 48 8b 03 48 83 e0 f8 48 39 c5 0f 85 24 01 00 00 <48> 8d 7d 34 48 89 f8 48 89 f9 48 c1 e8 03 83 e1 07 42 0f b6 04 38
RSP: 0018:ffffc90023b476b0 EFLAGS: 00000246
RAX: ffff888027e88000 RBX: ffff88802db3a150 RCX: ffffffff81e60db9
RDX: 0000000000000001 RSI: 0000000000000008 RDI: ffff88802db3a150
RBP: ffff888027e88000 R08: 0000000000000000 R09: ffffed1005b6742a
R10: ffff88802db3a157 R11: 0000000000000000 R12: ffffed10056b84b0
R13: ffff88802b5c2580 R14: 0000000000000000 R15: dffffc0000000000
mutex_optimistic_spin kernel/locking/mutex.c:509 [inline]
__mutex_lock_common kernel/locking/mutex.c:761 [inline]
__mutex_lock+0x12c3/0x1bc0 kernel/locking/mutex.c:821
tty_lock_interruptible+0x75/0xe0 drivers/tty/tty_mutex.c:27
tty_open_by_driver drivers/tty/tty_io.c:2032 [inline]
tty_open+0x5e7/0xe20 drivers/tty/tty_io.c:2093
chrdev_open+0x234/0x6a0 fs/char_dev.c:411
do_dentry_open+0x6ab/0x14d0 fs/open.c:996
vfs_open+0x82/0x3f0 fs/open.c:1101
do_open fs/namei.c:4837 [inline]
path_openat+0x19fa/0x2440 fs/namei.c:5000
do_file_open+0x20e/0x430 fs/namei.c:5029
do_sys_openat2+0x10f/0x1e0 fs/open.c:1417
do_sys_open fs/open.c:1423 [inline]
__do_sys_openat fs/open.c:1439 [inline]
__se_sys_openat fs/open.c:1434 [inline]
__x64_sys_openat+0x12d/0x210 fs/open.c:1434
do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
do_syscall_64+0x123/0x790 arch/x86/entry/syscall_64.c:84
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7ff210d9e159
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ff211c5e028 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007ff211025fa0 RCX: 00007ff210d9e159
RDX: 0000000000000002 RSI: 0000200000000400 RDI: ffffffffffffff9c
RBP: 00007ff210e35024 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ff211026038 R14: 00007ff211025fa0 R15: 00007ffc38d9dfd8
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:__list_add_valid_or_report.cold+0x34/0x36 lib/list_debug.c:35
Code: eb ff 90 0f 0b 48 c7 c7 00 0d 62 8c e8 7a be eb ff 90 0f 0b 48 89 d9 4c 89 ea 48 89 ee 48 c7 c7 40 0f 62 8c e8 62 be eb ff 90 <0f> 0b 48 89 de 48 c7 c7 00 10 62 8c e8 50 be eb ff 90 0f 0b 48 89
RSP: 0018:ffffc900006588b8 EFLAGS: 00010086
RAX: 0000000000000058 RBX: ffff888054867878 RCX: 0000000000000000
RDX: 0000000000000058 RSI: ffffffff81e9e1d9 RDI: fffff520000cb108
RBP: ffff88803dbb4e18 R08: 0000000000000007 R09: 0000000000000000
R10: 8000000000000103 R11: 0000000000000001 R12: ffff888054867880
R13: ffff88803dbb4e18 R14: 0000000000000000 R15: ffff88803dbb4e18
FS: 00007ff211c5e6c0(0000) GS:ffff8880d5d64000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f348dc70050 CR3: 000000002dba6000 CR4: 0000000000352ef0
----------------
Code disassembly (best guess):
0: 48 89 df mov %rbx,%rdi
3: e8 d7 f0 98 00 call 0x98f0df
8: 48 89 d8 mov %rbx,%rax
b: 48 c1 e8 03 shr $0x3,%rax
f: 42 80 3c 38 00 cmpb $0x0,(%rax,%r15,1)
14: 0f 85 c0 01 00 00 jne 0x1da
1a: 48 8b 03 mov (%rbx),%rax
1d: 48 83 e0 f8 and $0xfffffffffffffff8,%rax
21: 48 39 c5 cmp %rax,%rbp
24: 0f 85 24 01 00 00 jne 0x14e
* 2a: 48 8d 7d 34 lea 0x34(%rbp),%rdi <-- trapping instruction
2e: 48 89 f8 mov %rdi,%rax
31: 48 89 f9 mov %rdi,%rcx
34: 48 c1 e8 03 shr $0x3,%rax
38: 83 e1 07 and $0x7,%ecx
3b: 42 0f b6 04 38 movzbl (%rax,%r15,1),%eax
Tested on:
commit: 08dbfad3 Merge tag 'for-linus' of git://git.kernel.org..
git tree: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=17f68349580000
kernel config: https://syzkaller.appspot.com/x/.config?x=8c5c3949d762a91f
dashboard link: https://syzkaller.appspot.com/bug?extid=5fabc1ae99ff40690d84
compiler: gcc (Debian 14.2.0-19) 14.2.0, GNU ld (GNU Binutils for Debian) 2.44
patch: https://syzkaller.appspot.com/x/patch.diff?x=10fd7379580000
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [syzbot] [usb?] KASAN: slab-use-after-free Write in keyspan_close
[not found] <20260831001012.8665-1-kartikey406@gmail.com>
@ 2026-08-31 0:37 ` syzbot
0 siblings, 0 replies; 7+ messages in thread
From: syzbot @ 2026-08-31 0:37 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+5fabc1ae99ff40690d84@syzkaller.appspotmail.com
Tested-by: syzbot+5fabc1ae99ff40690d84@syzkaller.appspotmail.com
Tested on:
commit: cee9395a Linux 7.3-rc1
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=13a68349580000
kernel config: https://syzkaller.appspot.com/x/.config?x=8c5c3949d762a91f
dashboard link: https://syzkaller.appspot.com/bug?extid=5fabc1ae99ff40690d84
compiler: gcc (Debian 14.2.0-19) 14.2.0, GNU ld (GNU Binutils for Debian) 2.44
patch: https://syzkaller.appspot.com/x/patch.diff?x=155a8349580000
Note: testing is done by a robot and is best-effort only.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-08-31 1:02 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-30 15:03 [syzbot] [usb?] KASAN: slab-use-after-free Write in keyspan_close syzbot
2026-08-30 23:50 ` Edward Adam Davis
2026-08-31 0:14 ` syzbot
2026-08-31 0:10 ` Forwarded: [PATCH] USB: serial: keyspan: fix use-after-free " syzbot
2026-08-31 0:38 ` [syzbot] [usb?] KASAN: slab-use-after-free Write " Edward Adam Davis
2026-08-31 1:02 ` syzbot
[not found] <20260831001012.8665-1-kartikey406@gmail.com>
2026-08-31 0:37 ` syzbot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®