KASAN: slab-use-after-free Write in tty_init_dev

Status: upstream: reported C repro on 2026/07/31 06:14
Subsystems: serial
Labels: prio:normal
[Documentation on labels]
Reported-by: syzbot+fe63e4d633540f230624@syzkaller.appspotmail.com
Fix commit: 1981b53c2b52 usb: gadget: u_serial: pin ports while TTYs are installed
Patched on: [ci-qemu-gce-upstream-auto ci-qemu-upstream ci-qemu-upstream-386 ci-qemu2-arm32 ci-qemu2-arm64 ci-qemu2-arm64-compat ci-qemu2-arm64-mte ci-snapshot-upstream-root ci-upstream-bpf-kasan-gce ci-upstream-bpf-next-kasan-gce ci-upstream-gce-leak ci-upstream-kasan-badwrites-root ci-upstream-kasan-gce ci-upstream-kasan-gce-386 ci-upstream-kasan-gce-root ci-upstream-kasan-gce-selinux-root ci-upstream-kasan-gce-smack-root ci-upstream-linux-next-kasan-gce-root ci-upstream-net-kasan-gce ci-upstream-net-this-kasan-gce ci-upstream-rust-kasan-gce ci2-upstream-fs ci2-upstream-kcsan-gce ci2-upstream-usb], missing on: [ci-qemu-native-arm64-kvm ci-qemu2-riscv64 ci-upstream-gce-arm64 ci-upstream-kmsan-gce-386-root ci-upstream-kmsan-gce-root]
First crash: 119d, last: 9d23h
▶ ▼ ✨ AI Patch Versions (7)
Version Stage Reported Report Link Job
1 upstream 2026/10/02 15:54 Discussion ec789387-2e7b-4a8f-a7a1-a47bf7fa57f5
6 moderation 2026/10/02 15:26 Discussion ec789387-2e7b-4a8f-a7a1-a47bf7fa57f5
5 moderation 2026/10/01 13:23 Discussion 80d6efd5-e349-4663-8b4d-c08e605a4517
4 moderation 2026/09/28 20:19 Discussion 47fc8e8b-9ef9-4e57-8471-e728e0d08b61
3 moderation 2026/09/10 16:27 Discussion 957ebad8-eaaa-4b1f-923f-1a8b49536793
2 moderation 2026/09/10 11:27 Discussion 0076f60b-d76e-4eb9-b805-b385e7452af0
1 moderation 2026/09/08 12:00 Discussion b41b38ff-60c3-4626-adff-58b24c0a4cbc
▶ ▼ ✨ AI Jobs (9)
ID Workflow Result Correct Bug Created Started Finished Revision
e9310747 patch-iteration ❓ KASAN: slab-use-after-free Write in tty_init_dev 2026/10/02 15:25 2026/10/02 15:26 2026/10/02 17:23 57bbd979
ec789387 patch-iteration ✅ KASAN: slab-use-after-free Write in tty_init_dev 2026/10/02 14:12 2026/10/02 14:12 2026/10/02 15:25 57bbd979
80d6efd5 patch-iteration ❓ KASAN: slab-use-after-free Write in tty_init_dev 2026/10/01 11:24 2026/10/01 11:24 2026/10/01 13:23 38f7f0d1
47fc8e8b patch-iteration ❓ KASAN: slab-use-after-free Write in tty_init_dev 2026/09/28 16:55 2026/09/28 16:55 2026/09/28 20:19 58f15308
957ebad8 patch-iteration ❓ KASAN: slab-use-after-free Write in tty_init_dev 2026/09/10 16:00 2026/09/10 16:00 2026/09/10 16:27 1fe56c0a
af2372bc patch-iteration ❓ KASAN: slab-use-after-free Write in tty_init_dev 2026/09/10 11:27 2026/09/10 11:27 2026/09/10 12:56 1fe56c0a
0076f60b patch-iteration ❓ KASAN: slab-use-after-free Write in tty_init_dev 2026/09/10 10:29 2026/09/10 10:29 2026/09/10 11:27 1fe56c0a
b41b38ff patching ❓ KASAN: slab-use-after-free Write in tty_init_dev 2026/09/08 09:31 2026/09/08 09:31 2026/09/08 12:00 680aa3e1
7b53c78e assessment-security DenialOfService: ✅ Exploitable: ✅ FilesystemTrigger: ❌ NetworkTrigger: ❌ PeripheralTrigger: ❌ RemoteTrigger: ❌ Unprivileged: ❌ UserNamespace: ❌ VMGuestTrigger: ❌ VMHostTrigger: ❌ ❓ KASAN: slab-use-after-free Write in tty_init_dev 2026/07/29 01:36 2026/07/29 01:36 2026/07/29 02:22 7be3c40b
▶ ▼ Discussions (5)
Title Replies (including bot) Last reply
[PATCH v2] usb: gadget: u_serial: fix use-after-free between tty open/close and gserial_free_line 4 (4) 2026/11/23 12:53
[PATCH] usb: gadget: u_serial: pin ports while TTYs are installed 4 (4) 2026/10/28 01:42
[PATCH] usb: gadget: u_serial: fix use-after-free between tty open/close and gserial_free_line 6 (6) 2026/10/20 12:39
[syzbot] [serial?] KASAN: slab-use-after-free Write in tty_init_dev 0 (7) 2026/09/10 06:09
[syzbot] Monthly serial report (Aug 2026) 0 (1) 2026/08/04 12:32
▶ ▼ Similar bugs (1)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-6-12 KASAN: slab-use-after-free Write in tty_init_dev origin:upstream 22 syz, C 1 10d 10d 0/1 premoderation: reported C repro on 2026/11/13 21:57
▶ ▼ Last patch testing requests (7)
Created Duration User Patch Repo Result
2026/09/18 14:01 12m retest repro upstream report job log log
2026/09/18 14:01 13m retest repro upstream report job log log
2026/09/10 06:09 14m syedtayyabfarooq08@gmail.com patch upstream OK job log log
2026/09/09 13:06 12m syedtayyabfarooq08@gmail.com patch upstream report job log log
2026/09/09 11:35 8m syedtayyabfarooq08@gmail.com patch upstream error job log
2026/09/09 07:44 13m syedtayyabfarooq08@gmail.com patch upstream report job log log
2026/09/09 07:10 12m syedtayyabfarooq08@gmail.com patch upstream report job log log

Sample crash report:
==================================================================
BUG: KASAN: slab-use-after-free in tty_init_dev+0x244/0x4d0 drivers/tty/tty_io.c:1399
Write of size 8 at addr ffff88805d04f120 by task syz.2.42/6196

CPU: 0 UID: 0 PID: 6196 Comm: syz.2.42 Not tainted syzkaller #0 PREEMPT_{RT,(full)} 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
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
 tty_init_dev+0x244/0x4d0 drivers/tty/tty_io.c:1399
 tty_open_by_driver drivers/tty/tty_io.c:2048 [inline]
 tty_open+0x7ea/0xd90 drivers/tty/tty_io.c:2095
 chrdev_open+0x4dc/0x600 fs/char_dev.c:413
 do_dentry_open+0x841/0x1410 fs/open.c:1000
 vfs_open_consume+0x4a/0x360 fs/open.c:1131
 do_open fs/namei.c:4851 [inline]
 path_openat+0x1701/0x2100 fs/namei.c:5016
 do_file_open+0x23e/0x4a0 fs/namei.c:5045
 do_sys_openat2+0x115/0x200 fs/open.c:1443
 do_sys_open fs/open.c:1449 [inline]
 __do_sys_openat fs/open.c:1465 [inline]
 __se_sys_openat fs/open.c:1460 [inline]
 __x64_sys_openat+0x138/0x170 fs/open.c:1460
 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
 do_syscall_64+0x16a/0x530 arch/x86/entry/syscall_64.c:89
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f979ea994d9
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:00007f979e0e6028 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007f979ed15fa0 RCX: 00007f979ea994d9
RDX: 0000000000000002 RSI: 0000200000000980 RDI: ffffffffffffff9c
RBP: 00007f979eb2804e R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f979ed16038 R14: 00007f979ed15fa0 R15: 00007ffcbb5cb618
 </TASK>

Allocated by task 6194:
 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:409 [inline]
 __kasan_kmalloc+0x93/0xb0 mm/kasan/common.c:426
 kasan_kmalloc include/linux/kasan.h:263 [inline]
 __kmalloc_cache_noprof+0x3d0/0x670 mm/slub.c:5680
 _kmalloc_noprof include/linux/slab.h:991 [inline]
 _kzalloc_noprof include/linux/slab.h:1312 [inline]
 gs_port_alloc drivers/usb/gadget/function/u_serial.c:1218 [inline]
 gserial_alloc_line_no_console+0x23a/0x6e0 drivers/usb/gadget/function/u_serial.c:1298
 gserial_alloc_line+0x18/0x90 drivers/usb/gadget/function/u_serial.c:1332
 acm_alloc_instance+0xc7/0x140 drivers/usb/gadget/function/f_acm.c:891
 try_get_usb_function_instance drivers/usb/gadget/functions.c:28 [inline]
 usb_get_function_instance+0xe3/0x2f0 drivers/usb/gadget/functions.c:44
 function_make+0x127/0x360 drivers/usb/gadget/configfs.c:626
 configfs_mkdir+0x4f6/0x9e0 fs/configfs/dir.c:1369
 vfs_mkdir+0x417/0x670 fs/namei.c:5428
 filename_mkdirat+0x288/0x560 fs/namei.c:5461
 __do_sys_mkdir fs/namei.c:5488 [inline]
 __se_sys_mkdir+0x34/0x150 fs/namei.c:5485
 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
 do_syscall_64+0x16a/0x530 arch/x86/entry/syscall_64.c:89
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Freed by task 6194:
 kasan_save_stack mm/kasan/common.c:57 [inline]
 kasan_save_track+0x3e/0x80 mm/kasan/common.c:78
 kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:584
 poison_slab_object mm/kasan/common.c:264 [inline]
 __kasan_slab_free+0x5c/0x80 mm/kasan/common.c:296
 kasan_slab_free include/linux/kasan.h:235 [inline]
 slab_free_hook mm/slub.c:2780 [inline]
 slab_free mm/slub.c:6630 [inline]
 kfree+0x1c5/0x6d0 mm/slub.c:6923
 gserial_free_port+0x243/0x2c0 drivers/usb/gadget/function/u_serial.c:1262
 gserial_free_line+0xc3/0x1f0 drivers/usb/gadget/function/u_serial.c:1279
 acm_free_instance+0x39/0x60 drivers/usb/gadget/function/f_acm.c:875
 usb_put_function_instance+0x95/0xc0 drivers/usb/gadget/functions.c:77
 config_item_cleanup fs/configfs/item.c:128 [inline]
 config_item_release+0x13a/0x2d0 fs/configfs/item.c:137
 configfs_rmdir+0x885/0x950 fs/configfs/dir.c:1580
 vfs_rmdir+0x3e9/0x700 fs/namei.c:5533
 filename_rmdir+0x276/0x510 fs/namei.c:5590
 __do_sys_rmdir fs/namei.c:5613 [inline]
 __se_sys_rmdir+0x2e/0x140 fs/namei.c:5610
 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
 do_syscall_64+0x16a/0x530 arch/x86/entry/syscall_64.c:89
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

The buggy address belongs to the object at ffff88805d04f000
 which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 288 bytes inside of
 freed 2048-byte region [ffff88805d04f000, ffff88805d04f800)

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x5d048
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0x80000000000040(head|node=0|zone=1)
page_type: f5(slab)
raw: 0080000000000040 ffff88813ff19000 dead000000000100 dead000000000122
raw: 0000000000000000 0000000000080008 00000000f5000000 0000000000000000
head: 0080000000000040 ffff88813ff19000 dead000000000100 dead000000000122
head: 0000000000000000 0000000000080008 00000000f5000000 0000000000000000
head: 0080000000000003 fffffffffffffe01 00000000ffffffff 00000000ffffffff
head: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000008
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd2820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5811, tgid 5811 (syz-executor), ts 130806276717
 set_page_owner include/linux/page_owner.h:33 [inline]
 post_alloc_hook+0x1f9/0x250 mm/page_alloc.c:1860
 prep_new_page mm/page_alloc.c:1868 [inline]
 get_page_from_freelist+0x25d4/0x2650 mm/page_alloc.c:3950
 __alloc_frozen_pages_noprof+0x230/0x470 mm/page_alloc.c:5492
 alloc_slab_page mm/slub.c:3384 [inline]
 allocate_slab+0x7d/0x5e0 mm/slub.c:3499
 new_slab mm/slub.c:3550 [inline]
 refill_objects+0x2d8/0x350 mm/slub.c:7539
 refill_sheaf mm/slub.c:2917 [inline]
 __pcs_replace_empty_main+0x339/0x690 mm/slub.c:4811
 alloc_from_pcs mm/slub.c:4887 [inline]
 slab_alloc_node mm/slub.c:5021 [inline]
 __do_kmalloc_node mm/slub.c:5530 [inline]
 __kmalloc_node_track_caller_noprof+0x619/0x7b0 mm/slub.c:5662
 kmalloc_reserve net/core/skbuff.c:638 [inline]
 pskb_expand_head+0x24b/0x15d0 net/core/skbuff.c:2330
 netlink_trim+0x1b3/0x2c0 net/netlink/af_netlink.c:1317
 netlink_broadcast_filtered+0x77/0x1060 net/netlink/af_netlink.c:1539
 nlmsg_multicast_filtered include/net/netlink.h:1165 [inline]
 nlmsg_multicast include/net/netlink.h:1184 [inline]
 nlmsg_notify+0xe3/0x1a0 net/netlink/af_netlink.c:2628
 __dev_notify_flags+0x257/0x510 net/core/dev.c:10059
 rtnl_configure_link+0x2f5/0x510 net/core/rtnetlink.c:3769
 rtnl_newlink_create+0x343/0x7b0 net/core/rtnetlink.c:4014
 __rtnl_newlink net/core/rtnetlink.c:4135 [inline]
 rtnl_newlink+0x167a/0x1c30 net/core/rtnetlink.c:4252
 rtnetlink_rcv_msg+0x802/0xc00 net/core/rtnetlink.c:7169
page last free pid 72 tgid 72 ts 128582951573 stack trace:
 reset_page_owner include/linux/page_owner.h:26 [inline]
 __free_pages_prepare mm/page_alloc.c:1402 [inline]
 __free_pages_ok+0xb27/0xc20 mm/page_alloc.c:1582
 fq_reset include/net/fq_impl.h:386 [inline]
 ieee80211_txq_teardown_flows+0x15f/0x200 net/mac80211/tx.c:1704
 ieee80211_unregister_hw+0x65/0x2d0 net/mac80211/main.c:1727
 mac80211_hwsim_del_radio+0x31a/0x500 drivers/net/wireless/virtual/mac80211_hwsim_main.c:6302
 hwsim_exit_net+0xea9/0xf70 drivers/net/wireless/virtual/mac80211_hwsim_main.c:7365
 ops_exit_list net/core/net_namespace.c:200 [inline]
 ops_undo_list+0x451/0x8f0 net/core/net_namespace.c:253
 cleanup_net+0x57b/0x810 net/core/net_namespace.c:713
 process_one_work kernel/workqueue.c:3495 [inline]
 process_scheduled_works+0xc3d/0x1630 kernel/workqueue.c:3578
 worker_thread+0xa47/0xfb0 kernel/workqueue.c:3659
 kthread+0x38b/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

Memory state around the buggy address:
 ffff88805d04f000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88805d04f080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88805d04f100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                               ^
 ffff88805d04f180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88805d04f200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (8):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/11/13 23:24 upstream 7e1392a42ea2 be5d1971 .config console log report syz / log C [disk image] [vmlinux] [kernel image] ci2-upstream-fs KASAN: slab-use-after-free Write in tty_init_dev
2026/09/04 12:52 git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git bc35965f6940 746171ee .config console log report C ci-qemu-upstream KASAN: slab-use-after-free Write in tty_init_dev
2026/09/04 12:38 git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git bc35965f6940 746171ee .config console log report C ci-qemu-upstream KASAN: slab-use-after-free Write in tty_init_dev
2026/07/29 12:21 upstream fc02acf6ac0c 19622d9d .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root KASAN: slab-use-after-free Write in tty_init_dev
2026/07/29 12:19 upstream fc02acf6ac0c 19622d9d .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root KASAN: slab-use-after-free Write in tty_init_dev
2026/07/28 14:15 upstream 62cc90241548 45ae1df4 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-badwrites-root KASAN: slab-use-after-free Write in tty_init_dev
2026/07/27 13:12 upstream f5098b6bae76 492bab15 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root KASAN: slab-use-after-free Write in tty_init_dev
2026/07/27 06:06 upstream 4235cb24ec1e 492bab15 .config console log report info [disk image] [vmlinux] [kernel image] ci-upstream-kasan-gce-selinux-root KASAN: slab-use-after-free Write in tty_init_dev
* Struck through repros no longer work on HEAD.