public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
* [syzbot] [usb?] KASAN: invalid-free in dev_free (3)
@ 2026-03-25 15:39 syzbot
  0 siblings, 0 replies; only message in thread
From: syzbot @ 2026-03-25 15:39 UTC (permalink / raw)
  To: andreyknvl, gregkh, linux-kernel, linux-usb, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    785f0eb2f85d Add linux-next specific files for 20260320
git tree:       linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=112d01d6580000
kernel config:  https://syzkaller.appspot.com/x/.config?x=c584910d0d74158d
dashboard link: https://syzkaller.appspot.com/bug?extid=25612fe5ab3dcafc3aab
compiler:       Debian clang version 21.1.8 (++20251221033036+2078da43e25a-1~exp1~20251221153213.50), Debian LLD 21.1.8

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/a1f7fd9c1a63/disk-785f0eb2.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/6c138da87c25/vmlinux-785f0eb2.xz
kernel image: https://storage.googleapis.com/syzbot-assets/4d1be64e56db/bzImage-785f0eb2.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+25612fe5ab3dcafc3aab@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: double-free in dev_free+0x424/0x740 drivers/usb/gadget/legacy/raw_gadget.c:226
Free of addr ffff888049a1c7e0 by task syz.8.3380/23768

CPU: 1 UID: 0 PID: 23768 Comm: syz.8.3380 Tainted: G             L      syzkaller #0 PREEMPT(full) 
Tainted: [L]=SOFTLOCKUP
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/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_invalid_free+0xea/0x110 mm/kasan/report.c:557
 check_slab_allocation mm/kasan/common.c:-1 [inline]
 __kasan_slab_pre_free+0x104/0x120 mm/kasan/common.c:261
 kasan_slab_pre_free include/linux/kasan.h:199 [inline]
 slab_free_hook mm/slub.c:2634 [inline]
 slab_free mm/slub.c:6242 [inline]
 kfree+0x173/0x640 mm/slub.c:6557
 dev_free+0x424/0x740 drivers/usb/gadget/legacy/raw_gadget.c:226
 kref_put include/linux/kref.h:65 [inline]
 raw_release+0x199/0x260 drivers/usb/gadget/legacy/raw_gadget.c:474
 __fput+0x451/0x8c0 fs/file_table.c:500
 task_work_run+0x1d9/0x270 kernel/task_work.c:233
 exit_task_work include/linux/task_work.h:40 [inline]
 do_exit+0x926/0x2490 kernel/exit.c:974
 do_group_exit+0x21b/0x2d0 kernel/exit.c:1116
 get_signal+0x1284/0x1330 kernel/signal.c:3036
 arch_do_signal_or_restart+0xbc/0x830 arch/x86/kernel/signal.c:337
 __exit_to_user_mode_loop kernel/entry/common.c:64 [inline]
 exit_to_user_mode_loop+0x86/0x480 kernel/entry/common.c:98
 __exit_to_user_mode_prepare include/linux/irq-entry-common.h:238 [inline]
 syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:269 [inline]
 syscall_exit_to_user_mode include/linux/entry-common.h:325 [inline]
 do_syscall_64+0x32d/0xf80 arch/x86/entry/syscall_64.c:100
 entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fb1e575cfce
Code: Unable to access opcode bytes at 0x7fb1e575cfa4.
RSP: 002b:00007fb1e65cbf78 EFLAGS: 00000246 ORIG_RAX: 00000000000000e6
RAX: fffffffffffffdfc RBX: 00007fb1e65cc6c0 RCX: 00007fb1e575cfce
RDX: 00007fb1e65cbfd0 RSI: 0000000000000000 RDI: 0000000000000000
RBP: 00007fb1e5832c99 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fb1e5a16038 R14: 00007fb1e5a15fa0 R15: 00007ffe224b9cb8
 </TASK>

Allocated by task 23773:
 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]
 __do_kmalloc_node mm/slub.c:5292 [inline]
 __kmalloc_node_track_caller_noprof+0x4db/0x7b0 mm/slub.c:5400
 memdup_user+0x2b/0xd0 mm/util.c:221
 raw_ioctl_ep_enable drivers/usb/gadget/legacy/raw_gadget.c:848 [inline]
 raw_ioctl+0xdc5/0x41c0 drivers/usb/gadget/legacy/raw_gadget.c:1319
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:597 [inline]
 __se_sys_ioctl+0xfc/0x170 fs/ioctl.c:583
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0x14d/0xf80 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

Freed by task 23768:
 kasan_save_stack mm/kasan/common.c:57 [inline]
 kasan_save_track+0x3e/0x80 mm/kasan/common.c:78
 kasan_save_free_info+0x46/0x50 mm/kasan/generic.c:584
 poison_slab_object mm/kasan/common.c:253 [inline]
 __kasan_slab_free+0x5c/0x80 mm/kasan/common.c:285
 kasan_slab_free include/linux/kasan.h:235 [inline]
 slab_free_hook mm/slub.c:2689 [inline]
 slab_free mm/slub.c:6242 [inline]
 kfree+0x1c5/0x640 mm/slub.c:6557
 dev_free+0x424/0x740 drivers/usb/gadget/legacy/raw_gadget.c:226
 kref_put include/linux/kref.h:65 [inline]
 raw_release+0x199/0x260 drivers/usb/gadget/legacy/raw_gadget.c:474
 __fput+0x451/0x8c0 fs/file_table.c:500
 fput_close_sync+0x11f/0x240 fs/file_table.c:605
 __do_sys_close fs/open.c:1509 [inline]
 __se_sys_close fs/open.c:1494 [inline]
 __x64_sys_close+0x7e/0x110 fs/open.c:1494
 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
 do_syscall_64+0x14d/0xf80 arch/x86/entry/syscall_64.c:94
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

The buggy address belongs to the object at ffff888049a1c7e0
 which belongs to the cache kmalloc-16 of size 16
The buggy address is located 0 bytes inside of
 16-byte region [ffff888049a1c7e0, ffff888049a1c7f0)

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff888049a1cd60 pfn:0x49a1c
flags: 0xfff00000000200(workingset|node=0|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 00fff00000000200 ffff88801b041640 ffffea0000c63590 ffffea0000ae3d10
raw: ffff888049a1cd60 000000080080006f 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 17478, tgid 17477 (syz.2.2109), ts 1143246103783, free_ts 1143039730432
 set_page_owner include/linux/page_owner.h:32 [inline]
 post_alloc_hook+0x231/0x280 mm/page_alloc.c:1859
 prep_new_page mm/page_alloc.c:1867 [inline]
 get_page_from_freelist+0x2418/0x24b0 mm/page_alloc.c:3926
 __alloc_frozen_pages_noprof+0x233/0x3d0 mm/page_alloc.c:5213
 alloc_slab_page mm/slub.c:3278 [inline]
 allocate_slab+0x77/0x660 mm/slub.c:3467
 new_slab mm/slub.c:3525 [inline]
 refill_objects+0x339/0x3d0 mm/slub.c:7247
 refill_sheaf mm/slub.c:2816 [inline]
 __pcs_replace_empty_main+0x321/0x720 mm/slub.c:4651
 alloc_from_pcs mm/slub.c:4749 [inline]
 slab_alloc_node mm/slub.c:4883 [inline]
 __kmalloc_cache_noprof+0x392/0x660 mm/slub.c:5407
 kmalloc_noprof include/linux/slab.h:950 [inline]
 kzalloc_noprof include/linux/slab.h:1188 [inline]
 uapi_add_elm drivers/infiniband/core/uverbs_uapi.c:24 [inline]
 uapi_merge_method drivers/infiniband/core/uverbs_uapi.c:155 [inline]
 uapi_merge_obj_tree drivers/infiniband/core/uverbs_uapi.c:214 [inline]
 uapi_merge_def+0x1225/0x1890 drivers/infiniband/core/uverbs_uapi.c:297
 uapi_merge_def+0x2a7/0x1890 drivers/infiniband/core/uverbs_uapi.c:286
 uverbs_alloc_api+0x1a6/0x1a60 drivers/infiniband/core/uverbs_uapi.c:658
 ib_uverbs_create_uapi drivers/infiniband/core/uverbs_main.c:1138 [inline]
 ib_uverbs_add_one+0x40f/0x700 drivers/infiniband/core/uverbs_main.c:1194
 add_client_context+0x37c/0x7a0 drivers/infiniband/core/device.c:730
 enable_device_and_get+0x19c/0x3e0 drivers/infiniband/core/device.c:1340
 ib_register_device+0x110f/0x13e0 drivers/infiniband/core/device.c:1459
 siw_device_register drivers/infiniband/sw/siw/siw_main.c:71 [inline]
 siw_newlink+0x8fe/0xde0 drivers/infiniband/sw/siw/siw_main.c:430
 nldev_newlink+0x5bc/0x650 drivers/infiniband/core/nldev.c:1812
page last free pid 5921 tgid 5921 stack trace:
 reset_page_owner include/linux/page_owner.h:25 [inline]
 __free_pages_prepare mm/page_alloc.c:1403 [inline]
 __free_frozen_pages+0xbc7/0xd30 mm/page_alloc.c:2944
 vfree+0x1d1/0x2f0 mm/vmalloc.c:3472
 delayed_vfree_work+0x55/0x80 mm/vmalloc.c:3392
 process_one_work+0x9a3/0x1710 kernel/workqueue.c:3288
 process_scheduled_works kernel/workqueue.c:3379 [inline]
 worker_thread+0xba8/0x11e0 kernel/workqueue.c:3465
 kthread+0x388/0x470 kernel/kthread.c:436
 ret_from_fork+0x51e/0xb90 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:
 ffff888049a1c680: fa fb fc fc 00 00 fc fc fa fb fc fc 00 00 fc fc
 ffff888049a1c700: fa fb fc fc 00 00 fc fc fa fb fc fc fa fb fc fc
>ffff888049a1c780: 00 00 fc fc 00 07 fc fc 00 00 fc fc fa fb fc fc
                                                       ^
 ffff888049a1c800: 00 00 fc fc 00 06 fc fc 00 00 fc fc 00 00 fc fc
 ffff888049a1c880: 00 00 fc fc 00 00 fc fc fa fb fc fc fa fb fc fc
==================================================================


---
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 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] only message in thread

only message in thread, other threads:[~2026-03-25 15:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-25 15:39 [syzbot] [usb?] KASAN: invalid-free in dev_free (3) syzbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox