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

Status: premoderation: reported C repro on 2026/11/13 21:57
Bug presence: origin:upstream
[Documentation on labels]
Reported-by: syzbot+77e5ebaafe740b8349cb@syzkaller.appspotmail.com
First crash: 3d05h, last: 3d05h
▶ ▼ Bug presence (2)
Date Name Commit Repro Result
2026/11/15 lts (merge base) 6d15a1029d42 C [report] KASAN: slab-use-after-free Read in check_tty_count
2026/11/15 upstream (ToT) 23c62304dde2 C [report] KASAN: slab-use-after-free Write in tty_init_dev
▶ ▼ Similar bugs (1)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-use-after-free Write in tty_init_dev prio:normal serial 22 syz, C 8 3d04h 108d 19/29 upstream: reported C repro on 2026/07/31 06:14

Sample crash report:
==================================================================
BUG: KASAN: slab-use-after-free in tty_init_dev+0x251/0x4f0 drivers/tty/tty_io.c:1433
Write of size 8 at addr ffff888108bfc8a0 by task syz.0.27/408

CPU: 0 UID: 0 PID: 408 Comm: syz.0.27 Not tainted syzkaller #0 5676c8b0feefcba4e903dddff460827408f065be
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
Call Trace:
 <TASK>
 __dump_stack+0x21/0x30 lib/dump_stack.c:94
 dump_stack_lvl+0x140/0x1c0 lib/dump_stack.c:120
 print_address_description+0x71/0x210 mm/kasan/report.c:377
 print_report+0x4a/0x70 mm/kasan/report.c:481
 kasan_report+0x162/0x1a0 mm/kasan/report.c:594
 __asan_report_store8_noabort+0x1b/0x30 mm/kasan/report_generic.c:386
 tty_init_dev+0x251/0x4f0 drivers/tty/tty_io.c:1433
 tty_open_by_driver drivers/tty/tty_io.c:2082 [inline]
 tty_open+0xa09/0x10b0 drivers/tty/tty_io.c:2129
 chrdev_open+0x4e8/0x610 fs/char_dev.c:414
 do_dentry_open+0x97f/0x1510 fs/open.c:954
 vfs_open+0x86/0x240 fs/open.c:1086
 do_open fs/namei.c:3782 [inline]
 path_openat+0x2c49/0x35a0 fs/namei.c:3941
 do_filp_open+0x1f2/0x440 fs/namei.c:3968
 do_sys_openat2+0x134/0x1d0 fs/open.c:1434
 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+0x13a/0x170 fs/open.c:1460
 x64_sys_call+0xe69/0x2ee0 arch/x86/include/generated/asm/syscalls_64.h:258
 do_syscall_x64 arch/x86/entry/common.c:47 [inline]
 do_syscall_64+0x57/0xf0 arch/x86/entry/common.c:78
 entry_SYSCALL_64_after_hwframe+0x76/0x7e
RIP: 0033:0x7f537a5a94d9
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:00007ffcb41819e8 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007f537a825fa0 RCX: 00007f537a5a94d9
RDX: 0000000000000002 RSI: 0000200000000980 RDI: ffffffffffffff9c
RBP: 00007f537a63804e R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f537a825fac R14: 00007f537a825fa0 R15: 00007f537a825fa0
 </TASK>

Allocated by task 406:
 kasan_save_stack mm/kasan/common.c:49 [inline]
 kasan_save_track+0x3e/0x80 mm/kasan/common.c:70
 kasan_save_alloc_info+0x3a/0x50 mm/kasan/generic.c:565
 poison_kmalloc_redzone mm/kasan/common.c:379 [inline]
 __kasan_kmalloc+0x96/0xb0 mm/kasan/common.c:396
 kasan_kmalloc include/linux/kasan.h:261 [inline]
 __kmalloc_cache_noprof+0x23c/0x470 mm/slub.c:4428
 kmalloc_noprof include/linux/slab.h:882 [inline]
 kzalloc_noprof include/linux/slab.h:1117 [inline]
 gs_port_alloc drivers/usb/gadget/function/u_serial.c:1181 [inline]
 gserial_alloc_line_no_console+0x245/0x770 drivers/usb/gadget/function/u_serial.c:1261
 gserial_alloc_line+0x19/0x30 drivers/usb/gadget/function/u_serial.c:1295
 acm_alloc_instance+0xd7/0x1e0 drivers/usb/gadget/function/f_acm.c:891
 try_get_usb_function_instance drivers/usb/gadget/functions.c:28 [inline]
 usb_get_function_instance+0xfa/0x320 drivers/usb/gadget/functions.c:44
 function_make+0x125/0x370 drivers/usb/gadget/configfs.c:631
 configfs_mkdir+0x523/0xb70 fs/configfs/dir.c:1339
 vfs_mkdir+0x58e/0x810 fs/namei.c:4265
 do_mkdirat+0x240/0x530 fs/namei.c:4288
 __do_sys_mkdir fs/namei.c:4308 [inline]
 __se_sys_mkdir fs/namei.c:4306 [inline]
 __x64_sys_mkdir+0x70/0x80 fs/namei.c:4306
 x64_sys_call+0x26c8/0x2ee0 arch/x86/include/generated/asm/syscalls_64.h:84
 do_syscall_x64 arch/x86/entry/common.c:47 [inline]
 do_syscall_64+0x57/0xf0 arch/x86/entry/common.c:78
 entry_SYSCALL_64_after_hwframe+0x76/0x7e

Freed by task 406:
 kasan_save_stack mm/kasan/common.c:49 [inline]
 kasan_save_track+0x3e/0x80 mm/kasan/common.c:70
 kasan_save_free_info+0x44/0x50 mm/kasan/generic.c:579
 poison_slab_object mm/kasan/common.c:249 [inline]
 __kasan_slab_free+0x5f/0x80 mm/kasan/common.c:266
 kasan_slab_free include/linux/kasan.h:234 [inline]
 slab_free_hook mm/slub.c:2445 [inline]
 slab_free mm/slub.c:4716 [inline]
 kfree+0x158/0x440 mm/slub.c:4877
 gserial_free_port+0x244/0x2e0 drivers/usb/gadget/function/u_serial.c:1225
 gserial_free_line+0x9f/0x1b0 drivers/usb/gadget/function/u_serial.c:1242
 acm_free_instance+0x3d/0x60 drivers/usb/gadget/function/f_acm.c:875
 usb_put_function_instance+0x9f/0xc0 drivers/usb/gadget/functions.c:77
 acm_attr_release+0x19/0x30 drivers/usb/gadget/function/f_acm.c:793
 config_item_cleanup fs/configfs/item.c:128 [inline]
 config_item_release fs/configfs/item.c:137 [inline]
 kref_put include/linux/kref.h:65 [inline]
 config_item_put+0x175/0x240 fs/configfs/item.c:149
 configfs_rmdir+0x8e8/0x9b0 fs/configfs/dir.c:1550
 vfs_rmdir+0x3de/0x560 fs/namei.c:4348
 do_rmdir+0x29a/0x590 fs/namei.c:4407
 __do_sys_rmdir fs/namei.c:4426 [inline]
 __se_sys_rmdir fs/namei.c:4424 [inline]
 __x64_sys_rmdir+0x4b/0x60 fs/namei.c:4424
 x64_sys_call+0xaf7/0x2ee0 arch/x86/include/generated/asm/syscalls_64.h:85
 do_syscall_x64 arch/x86/entry/common.c:47 [inline]
 do_syscall_64+0x57/0xf0 arch/x86/entry/common.c:78
 entry_SYSCALL_64_after_hwframe+0x76/0x7e

The buggy address belongs to the object at ffff888108bfc800
 which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 160 bytes inside of
 freed 1024-byte region [ffff888108bfc800, ffff888108bfcc00)

The buggy address belongs to the physical page:
page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x108bf8
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0x4000000000000040(head|zone=1)
page_type: f5(slab)
raw: 4000000000000040 ffff888100041dc0 dead000000000122 0000000000000000
raw: 0000000000000000 0000000080100010 00000001f5000000 0000000000000000
head: 4000000000000040 ffff888100041dc0 dead000000000122 0000000000000000
head: 0000000000000000 0000000080100010 00000001f5000000 0000000000000000
head: 4000000000000003 ffffea000422fe01 ffffffffffffffff 0000000000000000
head: 0000000000000008 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 379, tgid 379 (syz-executor), ts 27458597404, free_ts 26300170727
 set_page_owner include/linux/page_owner.h:35 [inline]
 post_alloc_hook+0x37d/0x3b0 mm/page_alloc.c:1864
 prep_new_page+0x2d/0x180 mm/page_alloc.c:1872
 get_page_from_freelist+0x4aea/0x4ba0 mm/page_alloc.c:3949
 __alloc_pages_noprof+0x35a/0x7e0 mm/page_alloc.c:5316
 alloc_slab_page+0x6b/0x1e0 mm/slub.c:-1
 allocate_slab+0x69/0x430 mm/slub.c:2687
 new_slab mm/slub.c:2741 [inline]
 ___slab_alloc+0x591/0x8c0 mm/slub.c:3934
 __slab_alloc mm/slub.c:4025 [inline]
 __slab_alloc_node mm/slub.c:4078 [inline]
 slab_alloc_node mm/slub.c:4241 [inline]
 __do_kmalloc_node mm/slub.c:4396 [inline]
 __kmalloc_node_noprof+0x2e7/0x500 mm/slub.c:4403
 __kvmalloc_node_noprof+0x128/0x300 mm/util.c:672
 xt_alloc_table_info+0x63/0x150 net/netfilter/x_tables.c:1216
 do_replace net/ipv6/netfilter/ip6_tables.c:1141 [inline]
 do_ip6t_set_ctl+0x8d2/0xd70 net/ipv6/netfilter/ip6_tables.c:1641
 nf_setsockopt+0x28d/0x2b0 net/netfilter/nf_sockopt.c:101
 ipv6_setsockopt+0x130/0x170 net/ipv6/ipv6_sockglue.c:998
 tcp_setsockopt+0xef/0x110 net/ipv4/tcp.c:4064
 sock_common_setsockopt+0xb8/0xd0 net/core/sock.c:3874
 do_sock_setsockopt+0x27f/0x410 net/socket.c:2314
page last free pid 359 tgid 359 stack trace:
 reset_page_owner include/linux/page_owner.h:28 [inline]
 free_pages_prepare mm/page_alloc.c:1391 [inline]
 free_unref_page+0xb99/0xf50 mm/page_alloc.c:2877
 __free_pages+0x6b/0x3b0 mm/page_alloc.c:5403
 vfree+0x3ea/0x5b0 mm/vmalloc.c:3410
 kcov_put kernel/kcov.c:439 [inline]
 kcov_close+0x2c/0x70 kernel/kcov.c:535
 __fput+0x20b/0xa30 fs/file_table.c:447
 ____fput+0x20/0x30 fs/file_table.c:475
 task_work_run+0x1e8/0x260 kernel/task_work.c:246
 exit_task_work include/linux/task_work.h:43 [inline]
 do_exit+0xa46/0x2850 kernel/exit.c:961
 do_group_exit+0x21f/0x2f0 kernel/exit.c:1104
 get_signal+0x134c/0x1490 kernel/signal.c:2942
 arch_do_signal_or_restart+0xbc/0x700 arch/x86/kernel/signal.c:337
 exit_to_user_mode_loop kernel/entry/common.c:111 [inline]
 exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline]
 __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline]
 syscall_exit_to_user_mode+0x57/0xb0 kernel/entry/common.c:218
 do_syscall_64+0x63/0xf0 arch/x86/entry/common.c:84
 entry_SYSCALL_64_after_hwframe+0x76/0x7e

Memory state around the buggy address:
 ffff888108bfc780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888108bfc800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888108bfc880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                               ^
 ffff888108bfc900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888108bfc980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
BUG: kernel NULL pointer dereference, address: 00000000000001b0
#PF: supervisor write access in kernel mode
#PF: error_code(0x0002) - not-present page
PGD 8000000115a5d067 
P4D 8000000115a5d067 PUD 0 
Oops: Oops: 0002 [#1] PREEMPT SMP KASAN PTI
CPU: 0 UID: 0 PID: 408 Comm: syz.0.27 Tainted: G    B              syzkaller #0 5676c8b0feefcba4e903dddff460827408f065be
Tainted: [B]=BAD_PAGE
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
RIP: 0010:arch_atomic_try_cmpxchg arch/x86/include/asm/atomic.h:107 [inline]
RIP: 0010:raw_atomic_try_cmpxchg_acquire include/linux/atomic/atomic-arch-fallback.h:2170 [inline]
RIP: 0010:atomic_try_cmpxchg_acquire include/linux/atomic/atomic-instrumented.h:1302 [inline]
RIP: 0010:queued_spin_lock include/asm-generic/qspinlock.h:111 [inline]
RIP: 0010:do_raw_spin_lock include/linux/spinlock.h:188 [inline]
RIP: 0010:__raw_spin_lock_irq include/linux/spinlock_api_smp.h:120 [inline]
RIP: 0010:_raw_spin_lock_irq+0x9c/0x120 kernel/locking/spinlock.c:170
Code: 04 04 c7 44 24 20 00 00 00 00 be 04 00 00 00 e8 ca 2b 36 fc 4c 89 f7 be 04 00 00 00 e8 bd 2b 36 fc 8b 44 24 20 b9 01 00 00 00 <f0> 0f b1 0b 75 38 43 c6 44 3c 04 f8 48 c7 04 24 0e 36 e0 45 4b c7
RSP: 0018:ffffc90005b37400 EFLAGS: 00010097

RAX: 0000000000000000 RBX: 00000000000001b0 RCX: 0000000000000001
RDX: 0000000000000001 RSI: 0000000000000004 RDI: ffffc90005b37420
RBP: ffffc90005b37490 R08: 0000000000000003 R09: 0000000000000004
R10: dffffc0000000000 R11: fffff52000b66e84 R12: 1ffff92000b66e80
R13: dffffc0000000000 R14: ffffc90005b37420 R15: dffffc0000000000
FS:  000055557fd76500(0000) GS:ffff8881f6c00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00000000000001b0 CR3: 0000000117d7c000 CR4: 00000000003526b0
Call Trace:
 <TASK>
 spin_lock_irq include/linux/spinlock.h:377 [inline]
 gs_close+0xb1/0x9c0 drivers/usb/gadget/function/u_serial.c:686
 tty_release+0x32f/0x11e0 drivers/tty/tty_io.c:1754
 tty_open+0x687/0x10b0 drivers/tty/tty_io.c:2155
 chrdev_open+0x4e8/0x610 fs/char_dev.c:414
 do_dentry_open+0x97f/0x1510 fs/open.c:954
 vfs_open+0x86/0x240 fs/open.c:1086
 do_open fs/namei.c:3782 [inline]
 path_openat+0x2c49/0x35a0 fs/namei.c:3941
 do_filp_open+0x1f2/0x440 fs/namei.c:3968
 do_sys_openat2+0x134/0x1d0 fs/open.c:1434
 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+0x13a/0x170 fs/open.c:1460
 x64_sys_call+0xe69/0x2ee0 arch/x86/include/generated/asm/syscalls_64.h:258
 do_syscall_x64 arch/x86/entry/common.c:47 [inline]
 do_syscall_64+0x57/0xf0 arch/x86/entry/common.c:78
 entry_SYSCALL_64_after_hwframe+0x76/0x7e
RIP: 0033:0x7f537a5a94d9
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:00007ffcb41819e8 EFLAGS: 00000246 ORIG_RAX: 0000000000000101
RAX: ffffffffffffffda RBX: 00007f537a825fa0 RCX: 00007f537a5a94d9
RDX: 0000000000000002 RSI: 0000200000000980 RDI: ffffffffffffff9c
RBP: 00007f537a63804e R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f537a825fac R14: 00007f537a825fa0 R15: 00007f537a825fa0
 </TASK>
Modules linked in:
CR2: 00000000000001b0
---[ end trace 0000000000000000 ]---
RIP: 0010:arch_atomic_try_cmpxchg arch/x86/include/asm/atomic.h:107 [inline]
RIP: 0010:raw_atomic_try_cmpxchg_acquire include/linux/atomic/atomic-arch-fallback.h:2170 [inline]
RIP: 0010:atomic_try_cmpxchg_acquire include/linux/atomic/atomic-instrumented.h:1302 [inline]
RIP: 0010:queued_spin_lock include/asm-generic/qspinlock.h:111 [inline]
RIP: 0010:do_raw_spin_lock include/linux/spinlock.h:188 [inline]
RIP: 0010:__raw_spin_lock_irq include/linux/spinlock_api_smp.h:120 [inline]
RIP: 0010:_raw_spin_lock_irq+0x9c/0x120 kernel/locking/spinlock.c:170
Code: 04 04 c7 44 24 20 00 00 00 00 be 04 00 00 00 e8 ca 2b 36 fc 4c 89 f7 be 04 00 00 00 e8 bd 2b 36 fc 8b 44 24 20 b9 01 00 00 00 <f0> 0f b1 0b 75 38 43 c6 44 3c 04 f8 48 c7 04 24 0e 36 e0 45 4b c7
RSP: 0018:ffffc90005b37400 EFLAGS: 00010097
RAX: 0000000000000000 RBX: 00000000000001b0 RCX: 0000000000000001
RDX: 0000000000000001 RSI: 0000000000000004 RDI: ffffc90005b37420
RBP: ffffc90005b37490 R08: 0000000000000003 R09: 0000000000000004
R10: dffffc0000000000 R11: fffff52000b66e84 R12: 1ffff92000b66e80
R13: dffffc0000000000 R14: ffffc90005b37420 R15: dffffc0000000000
FS:  000055557fd76500(0000) GS:ffff8881f6c00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00000000000001b0 CR3: 0000000117d7c000 CR4: 00000000003526b0
----------------
Code disassembly (best guess):
   0:	04 04                	add    $0x4,%al
   2:	c7 44 24 20 00 00 00 	movl   $0x0,0x20(%rsp)
   9:	00
   a:	be 04 00 00 00       	mov    $0x4,%esi
   f:	e8 ca 2b 36 fc       	call   0xfc362bde
  14:	4c 89 f7             	mov    %r14,%rdi
  17:	be 04 00 00 00       	mov    $0x4,%esi
  1c:	e8 bd 2b 36 fc       	call   0xfc362bde
  21:	8b 44 24 20          	mov    0x20(%rsp),%eax
  25:	b9 01 00 00 00       	mov    $0x1,%ecx
* 2a:	f0 0f b1 0b          	lock cmpxchg %ecx,(%rbx) <-- trapping instruction
  2e:	75 38                	jne    0x68
  30:	43 c6 44 3c 04 f8    	movb   $0xf8,0x4(%r12,%r15,1)
  36:	48 c7 04 24 0e 36 e0 	movq   $0x45e0360e,(%rsp)
  3d:	45
  3e:	4b                   	rex.WXB
  3f:	c7                   	.byte 0xc7

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/11/13 21:56 android16-6.12 2dd32fade2dc be5d1971 .config console log report syz / log C [disk image] [vmlinux] [kernel image] ci2-android-6-12-rust KASAN: slab-use-after-free Write in tty_init_dev
* Struck through repros no longer work on HEAD.