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

Status: upstream: reported on 2026/11/15 15:23
Reported-by: syzbot+204755dd0778de543c9e@syzkaller.appspotmail.com
First crash: 4d15h, last: 4d15h
▶ ▼ Similar bugs (4)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: slab-use-after-free Write in gadgetfs_kill_sb prio:normal actionable usb 22 C error 5 77d 108d 0/29 upstream: reported C repro on 2026/08/04 02:08
linux-5.15 KASAN: use-after-free Write in gadgetfs_kill_sb 22 1 79d 79d 0/3 upstream: reported on 2026/09/01 15:24
linux-6.1 KASAN: use-after-free Write in gadgetfs_kill_sb 22 3 9d22h 28d 0/3 upstream: reported on 2026/10/22 19:31
upstream KASAN: use-after-free Write in gadgetfs_kill_sb usb 22 syz, C error 5 1403d 1437d 22/29 fixed on 2023/06/08 14:41

Sample crash report:
EXT4-fs error (device loop0): __ext4_iget:5117: inode #13: block 7962: comm syz-executor: invalid block
EXT4-fs error (device loop0): __ext4_iget:5117: inode #13: block 7962: comm syz-executor: invalid block
==================================================================
BUG: KASAN: slab-use-after-free in instrument_atomic_read_write include/linux/instrumented.h:96 [inline]
BUG: KASAN: slab-use-after-free in atomic_fetch_sub_release include/linux/atomic/atomic-instrumented.h:400 [inline]
BUG: KASAN: slab-use-after-free in __refcount_sub_and_test include/linux/refcount.h:272 [inline]
BUG: KASAN: slab-use-after-free in __refcount_dec_and_test include/linux/refcount.h:315 [inline]
BUG: KASAN: slab-use-after-free in refcount_dec_and_test include/linux/refcount.h:333 [inline]
BUG: KASAN: slab-use-after-free in put_dev drivers/usb/gadget/legacy/inode.c:159 [inline]
BUG: KASAN: slab-use-after-free in gadgetfs_kill_sb+0x43/0x110 drivers/usb/gadget/legacy/inode.c:2094
Write of size 4 at addr ffff888024de1040 by task syz-executor/5780

CPU: 1 PID: 5780 Comm: syz-executor Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
Call Trace:
 <TASK>
 dump_stack_lvl+0x18c/0x250 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:364 [inline]
 print_report+0xa8/0x210 mm/kasan/report.c:468
 kasan_report+0x117/0x150 mm/kasan/report.c:581
 check_region_inline mm/kasan/generic.c:-1 [inline]
 kasan_check_range+0x241/0x290 mm/kasan/generic.c:187
 instrument_atomic_read_write include/linux/instrumented.h:96 [inline]
 atomic_fetch_sub_release include/linux/atomic/atomic-instrumented.h:400 [inline]
 __refcount_sub_and_test include/linux/refcount.h:272 [inline]
 __refcount_dec_and_test include/linux/refcount.h:315 [inline]
 refcount_dec_and_test include/linux/refcount.h:333 [inline]
 put_dev drivers/usb/gadget/legacy/inode.c:159 [inline]
 gadgetfs_kill_sb+0x43/0x110 drivers/usb/gadget/legacy/inode.c:2094
 deactivate_locked_super+0x9c/0x210 fs/super.c:479
 cleanup_mnt+0x3d7/0x460 fs/namespace.c:1259
 task_work_run+0x1d4/0x260 kernel/task_work.c:245
 exit_task_work include/linux/task_work.h:43 [inline]
 do_exit+0x986/0x2530 kernel/exit.c:890
 do_group_exit+0x22d/0x2f0 kernel/exit.c:1032
 __do_sys_exit_group kernel/exit.c:1043 [inline]
 __se_sys_exit_group kernel/exit.c:1041 [inline]
 __x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1041
 do_syscall_x64 arch/x86/entry/common.c:46 [inline]
 do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:76
 entry_SYSCALL_64_after_hwframe+0x68/0xd2
RIP: 0033:0x7fc0773a94d9
Code: Unable to access opcode bytes at 0x7fc0773a94af.
RSP: 002b:00007ffdd431bf98 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 00007fc077437458 RCX: 00007fc0773a94d9
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000001
RBP: 0000000000000075 R08: 0000000000000000 R09: 00007fc077437433
R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffdd431d250
R13: 00007fc077437433 R14: 00005555750314e8 R15: 00007ffdd431f410
 </TASK>

Allocated by task 9895:
 kasan_save_stack mm/kasan/common.c:46 [inline]
 kasan_set_track+0x4e/0x70 mm/kasan/common.c:53
 ____kasan_kmalloc mm/kasan/common.c:375 [inline]
 __kasan_kmalloc+0x8f/0xa0 mm/kasan/common.c:384
 kasan_kmalloc include/linux/kasan.h:198 [inline]
 __do_kmalloc_node mm/slab_common.c:1007 [inline]
 __kmalloc_node+0xb6/0x240 mm/slab_common.c:1014
 kmalloc_node include/linux/slab.h:620 [inline]
 kzalloc_node include/linux/slab.h:732 [inline]
 qdisc_alloc+0x95/0xa80 net/sched/sch_generic.c:972
 qdisc_create+0x172/0x1060 net/sched/sch_api.c:1287
 tc_modify_qdisc+0xb47/0x1de0 net/sched/sch_api.c:-1
 rtnetlink_rcv_msg+0x843/0xf90 net/core/rtnetlink.c:6489
 netlink_rcv_skb+0x235/0x4c0 net/netlink/af_netlink.c:2554
 netlink_unicast_kernel net/netlink/af_netlink.c:1320 [inline]
 netlink_unicast+0x856/0x9e0 net/netlink/af_netlink.c:1346
 netlink_sendmsg+0x8d0/0xbf0 net/netlink/af_netlink.c:1903
 sock_sendmsg_nosec net/socket.c:730 [inline]
 __sock_sendmsg net/socket.c:745 [inline]
 ____sys_sendmsg+0x61b/0x980 net/socket.c:2595
 ___sys_sendmsg+0x2a6/0x360 net/socket.c:2649
 __sys_sendmsg net/socket.c:2678 [inline]
 __do_sys_sendmsg net/socket.c:2687 [inline]
 __se_sys_sendmsg+0x1d0/0x2c0 net/socket.c:2685
 do_syscall_x64 arch/x86/entry/common.c:46 [inline]
 do_syscall_64+0x55/0xb0 arch/x86/entry/common.c:76
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

Last potentially related work creation:
 kasan_save_stack+0x3e/0x60 mm/kasan/common.c:46
 __kasan_record_aux_stack+0xaf/0xc0 mm/kasan/generic.c:492
 __call_rcu_common kernel/rcu/tree.c:2721 [inline]
 call_rcu+0x153/0x900 kernel/rcu/tree.c:2837
 qdisc_put net/sched/sch_generic.c:1129 [inline]
 dev_shutdown+0x355/0x440 net/sched/sch_generic.c:1490
 unregister_netdevice_many_notify+0x8cf/0x1910 net/core/dev.c:11215
 unregister_netdevice_many net/core/dev.c:11281 [inline]
 unregister_netdevice_queue+0x2e9/0x330 net/core/dev.c:11161
 unregister_netdevice include/linux/netdevice.h:3198 [inline]
 __tun_detach+0xdb2/0x1580 drivers/net/tun.c:685
 tun_detach drivers/net/tun.c:701 [inline]
 tun_chr_close+0x10d/0x1c0 drivers/net/tun.c:3525
 __fput+0x221/0x940 fs/file_table.c:418
 task_work_run+0x1d4/0x260 kernel/task_work.c:245
 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
 exit_to_user_mode_loop+0xe6/0x110 kernel/entry/common.c:180
 exit_to_user_mode_prepare+0xee/0x180 kernel/entry/common.c:213
 __syscall_exit_to_user_mode_work kernel/entry/common.c:294 [inline]
 syscall_exit_to_user_mode+0x1a/0x50 kernel/entry/common.c:305
 do_syscall_64+0x61/0xb0 arch/x86/entry/common.c:82
 entry_SYSCALL_64_after_hwframe+0x68/0xd2

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

The buggy address belongs to the physical page:
page:ffffea0000937800 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888024de6800 pfn:0x24de0
head:ffffea0000937800 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0xfff00000000840(slab|head|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0xffffffff()
raw: 00fff00000000840 ffff888018c41dc0 ffffea0000cdf810 ffffea0001f6ca10
raw: ffff888024de6800 0000000000100004 00000001ffffffff 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 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5781, tgid 5781 (syz-executor), ts 73690819847, free_ts 73684967339
 set_page_owner include/linux/page_owner.h:31 [inline]
 post_alloc_hook+0x1c1/0x200 mm/page_alloc.c:1582
 prep_new_page mm/page_alloc.c:1589 [inline]
 get_page_from_freelist+0x2181/0x22a0 mm/page_alloc.c:3221
 __alloc_pages+0x1f0/0x460 mm/page_alloc.c:4501
 alloc_slab_page+0x5d/0x180 mm/slub.c:1903
 allocate_slab mm/slub.c:2050 [inline]
 new_slab+0x87/0x2d0 mm/slub.c:2103
 ___slab_alloc+0xc5c/0x12f0 mm/slub.c:3275
 __slab_alloc mm/slub.c:3361 [inline]
 __slab_alloc_node mm/slub.c:3414 [inline]
 slab_alloc_node mm/slub.c:3508 [inline]
 __kmem_cache_alloc_node+0x122/0x260 mm/slub.c:3557
 __do_kmalloc_node mm/slab_common.c:1006 [inline]
 __kmalloc_node+0xa6/0x240 mm/slab_common.c:1014
 kmalloc_node include/linux/slab.h:620 [inline]
 kzalloc_node include/linux/slab.h:732 [inline]
 qdisc_alloc+0x95/0xa80 net/sched/sch_generic.c:972
 qdisc_create_dflt+0x63/0x430 net/sched/sch_generic.c:1034
 attach_one_default_qdisc net/sched/sch_generic.c:1198 [inline]
 netdev_for_each_tx_queue include/linux/netdevice.h:2541 [inline]
 attach_default_qdiscs net/sched/sch_generic.c:1216 [inline]
 dev_activate+0x396/0x1160 net/sched/sch_generic.c:1275
 __dev_open+0x347/0x430 net/core/dev.c:1528
 __dev_change_flags+0x1e8/0x6a0 net/core/dev.c:8787
 dev_change_flags+0x7c/0x1a0 net/core/dev.c:8859
 do_setlink+0xc1f/0x3f00 net/core/rtnetlink.c:2922
 __rtnl_newlink net/core/rtnetlink.c:3720 [inline]
 rtnl_newlink+0x1848/0x2170 net/core/rtnetlink.c:3767
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1182 [inline]
 free_unref_page_prepare+0x7d7/0x8f0 mm/page_alloc.c:2366
 free_unref_page+0x32/0x2e0 mm/page_alloc.c:2459
 discard_slab mm/slub.c:2149 [inline]
 __unfreeze_partials+0x1cf/0x210 mm/slub.c:2689
 put_cpu_partial+0x17c/0x250 mm/slub.c:2765
 __slab_free+0x319/0x400 mm/slub.c:3723
 qlink_free mm/kasan/quarantine.c:166 [inline]
 qlist_free_all+0x75/0xd0 mm/kasan/quarantine.c:185
 kasan_quarantine_reduce+0x143/0x160 mm/kasan/quarantine.c:292
 __kasan_slab_alloc+0x22/0x80 mm/kasan/common.c:306
 kasan_slab_alloc include/linux/kasan.h:188 [inline]
 slab_post_alloc_hook+0x6a/0x4d0 mm/slab.h:770
 slab_alloc_node mm/slub.c:3518 [inline]
 __kmem_cache_alloc_node+0x197/0x260 mm/slub.c:3557
 __do_kmalloc_node mm/slab_common.c:1006 [inline]
 __kmalloc+0xa7/0x240 mm/slab_common.c:1020
 kmalloc include/linux/slab.h:604 [inline]
 tomoyo_realpath_from_path+0xe6/0x5c0 security/tomoyo/realpath.c:251
 tomoyo_mount_acl security/tomoyo/mount.c:141 [inline]
 tomoyo_mount_permission+0x91e/0x9d0 security/tomoyo/mount.c:237
 security_sb_mount+0x87/0xc0 security/security.c:1412
 path_mount+0xbc/0xfa0 fs/namespace.c:3709
 do_mount fs/namespace.c:3780 [inline]
 __do_sys_mount fs/namespace.c:3989 [inline]
 __se_sys_mount+0x2e7/0x3d0 fs/namespace.c:3966

Memory state around the buggy address:
 ffff888024de0f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888024de0f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888024de1000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                           ^
 ffff888024de1080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888024de1100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/11/15 15:23 linux-6.6.y 5139929c698c 819ebe34 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-6-kasan KASAN: slab-use-after-free Write in gadgetfs_kill_sb
* Struck through repros no longer work on HEAD.