================================================================== BUG: KASAN: slab-use-after-free in dvb_device_open+0x33f/0x3b0 drivers/media/dvb-core/dvbdev.c:99 Read of size 8 at addr ffff888044071218 by task syz.1.229/6878 CPU: 3 UID: 0 PID: 6878 Comm: syz.1.229 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: __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 dvb_device_open+0x33f/0x3b0 drivers/media/dvb-core/dvbdev.c:99 chrdev_open+0x234/0x6a0 fs/char_dev.c:413 do_dentry_open+0x674/0x1470 fs/open.c:1000 vfs_open_consume+0xcc/0x460 fs/open.c:1131 do_open fs/namei.c:4851 [inline] path_openat+0x1547/0x23f0 fs/namei.c:5016 do_file_open+0x20e/0x430 fs/namei.c:5045 do_sys_openat2+0x163/0x1d0 fs/open.c:1443 do_sys_open fs/open.c:1449 [inline] __do_compat_sys_openat fs/open.c:1511 [inline] __se_compat_sys_openat fs/open.c:1509 [inline] __ia32_compat_sys_openat+0x12d/0x210 fs/open.c:1509 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:79 [inline] do_int80_emulation+0x16a/0x670 arch/x86/entry/syscall_32.c:170 asm_int80_emulation+0x1a/0x20 arch/x86/include/asm/idtentry.h:598 RIP: 0023:0xf71e032b Code: 57 56 53 8b 44 24 14 f6 00 08 75 23 8b 44 24 18 8b 5c 24 1c 8b 4c 24 20 8b 54 24 24 8b 74 24 28 8b 7c 24 2c 8b 6c 24 30 cd 80 <5b> 5e 5f 5d c3 5b 5e 5f 5d e9 f7 a1 ff ff 66 90 66 90 66 90 90 53 RSP: 002b:00000000f547503c EFLAGS: 00000246 ORIG_RAX: 0000000000000127 RAX: ffffffffffffffda RBX: 00000000ffffff9c RCX: 00000000f5475100 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000292 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 Allocated by task 5905: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x40 mm/kasan/common.c:79 poison_kmalloc_redzone mm/kasan/common.c:412 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:429 kasan_kmalloc include/linux/kasan.h:267 [inline] __kmalloc_cache_noprof+0x2f8/0x6d0 mm/slub.c:5680 _kmalloc_noprof include/linux/slab.h:991 [inline] _kzalloc_noprof include/linux/slab.h:1312 [inline] snd_info_create_entry+0x51/0x400 sound/core/info.c:667 snd_info_create_module_entry sound/core/info.c:705 [inline] create_subdir sound/core/info.c:414 [inline] snd_info_card_create+0xdf/0x2b0 sound/core/info.c:488 snd_card_init+0x88a/0x1270 sound/core/init.c:350 snd_card_new+0x9d/0x120 sound/core/init.c:204 snd_usb_audio_create sound/usb/card.c:740 [inline] usb_audio_probe+0x16e4/0x3550 sound/usb/card.c:988 usb_probe_interface+0x386/0x980 drivers/usb/core/driver.c:399 call_driver_probe drivers/base/dd.c:629 [inline] really_probe+0x241/0xa60 drivers/base/dd.c:707 __driver_probe_device+0x210/0x460 drivers/base/dd.c:869 driver_probe_device+0x4a/0x140 drivers/base/dd.c:899 __device_attach_driver+0x1df/0x320 drivers/base/dd.c:1027 bus_for_each_drv+0x159/0x1e0 drivers/base/bus.c:500 __device_attach+0x1e4/0x4c0 drivers/base/dd.c:1131 device_initial_probe+0xaf/0xf0 drivers/base/dd.c:1190 __bus_probe_device+0x60/0x160 drivers/base/bus.c:614 device_add+0x121d/0x1970 drivers/base/core.c:3778 usb_set_configuration+0xd97/0x1dc0 drivers/usb/core/message.c:2280 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:629 [inline] really_probe+0x241/0xa60 drivers/base/dd.c:707 __driver_probe_device+0x210/0x460 drivers/base/dd.c:869 driver_probe_device+0x4a/0x140 drivers/base/dd.c:899 __device_attach_driver+0x1df/0x320 drivers/base/dd.c:1027 bus_for_each_drv+0x159/0x1e0 drivers/base/bus.c:500 __device_attach+0x1e4/0x4c0 drivers/base/dd.c:1131 device_initial_probe+0xaf/0xf0 drivers/base/dd.c:1190 __bus_probe_device+0x60/0x160 drivers/base/bus.c:614 device_add+0x121d/0x1970 drivers/base/core.c:3778 usb_new_device.part.0+0xcc2/0x1686 drivers/usb/core/hub.c:2713 usb_new_device include/linux/workqueue.h:715 [inline] hub_port_connect drivers/usb/core/hub.c:5585 [inline] hub_port_connect_change drivers/usb/core/hub.c:5725 [inline] port_event drivers/usb/core/hub.c:5889 [inline] hub_event.cold+0x1e3/0xe90 drivers/usb/core/hub.c:5971 process_one_work+0xac7/0x1b10 kernel/workqueue.c:3495 process_scheduled_works kernel/workqueue.c:3578 [inline] worker_thread+0x5ef/0xe50 kernel/workqueue.c:3659 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 25: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x40 mm/kasan/common.c:79 kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:599 poison_slab_object mm/kasan/common.c:267 [inline] __kasan_slab_free+0x73/0x90 mm/kasan/common.c:299 kasan_slab_free include/linux/kasan.h:239 [inline] slab_free_hook mm/slub.c:2780 [inline] slab_free mm/slub.c:6637 [inline] kfree+0x22d/0x6d0 mm/slub.c:6930 snd_info_free_entry sound/core/info.c:767 [inline] snd_info_card_free+0x51/0xa0 sound/core/info.c:570 snd_card_do_free sound/core/init.c:596 [inline] release_card_device+0x197/0x2b0 sound/core/init.c:169 device_release+0xd2/0x270 drivers/base/core.c:2640 kobject_cleanup lib/kobject.c:689 [inline] kobject_release lib/kobject.c:720 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x1f7/0x640 lib/kobject.c:737 put_device+0x1f/0x30 drivers/base/core.c:3886 snd_card_free_when_closed sound/core/init.c:625 [inline] snd_card_free_when_closed+0x2b/0x40 sound/core/init.c:619 usb_audio_disconnect+0x210/0x310 sound/usb/card.c:1142 usb_unbind_interface+0x1dd/0x9b0 drivers/usb/core/driver.c:460 device_remove drivers/base/dd.c:619 [inline] device_remove+0x12a/0x180 drivers/base/dd.c:611 __device_release_driver drivers/base/dd.c:1357 [inline] device_release_driver_internal+0x441/0x610 drivers/base/dd.c:1380 bus_remove_device+0x2bc/0x560 drivers/base/bus.c:678 device_del+0x376/0x9b0 drivers/base/core.c:3967 usb_disable_device+0x367/0x810 drivers/usb/core/message.c:1484 usb_disconnect+0x2e2/0x9a0 drivers/usb/core/hub.c:2355 hub_port_connect drivers/usb/core/hub.c:5425 [inline] hub_port_connect_change drivers/usb/core/hub.c:5725 [inline] port_event drivers/usb/core/hub.c:5889 [inline] hub_event+0x1bb1/0x4420 drivers/usb/core/hub.c:5971 process_one_work+0xac7/0x1b10 kernel/workqueue.c:3495 process_scheduled_works kernel/workqueue.c:3578 [inline] worker_thread+0x5ef/0xe50 kernel/workqueue.c:3659 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 ffff888044071200 which belongs to the cache kmalloc-256 of size 256 The buggy address is located 24 bytes inside of freed 256-byte region [ffff888044071200, ffff888044071300) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff888044071200 pfn:0x44070 head: order:1 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0x4fff00000000240(workingset|head|node=1|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 04fff00000000240 ffff88801d442b40 ffffea0001c98310 ffffea000140dd10 raw: ffff888044071200 000000000010000e 00000000f5000000 0000000000000000 head: 04fff00000000240 ffff88801d442b40 ffffea0001c98310 ffffea000140dd10 head: ffff888044071200 000000000010000e 00000000f5000000 0000000000000000 head: 04fff00000000001 ffffffffffffff81 00000000ffffffff 00000000ffffffff head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000002 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 1, migratetype Unmovable, gfp_mask 0xd2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 39, tgid 39 (kdevtmpfs), ts 10900543729 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0xfd/0x120 mm/page_alloc.c:1873 prep_new_page mm/page_alloc.c:1881 [inline] get_page_from_freelist+0xdae/0x2c80 mm/page_alloc.c:3963 __alloc_frozen_pages_noprof+0x2ad/0x31e0 mm/page_alloc.c:5505 alloc_slab_page mm/slub.c:3384 [inline] allocate_slab mm/slub.c:3499 [inline] new_slab+0xb1/0x6d0 mm/slub.c:3550 refill_objects+0xe3/0x410 mm/slub.c:7546 refill_sheaf mm/slub.c:2917 [inline] __pcs_replace_empty_main+0x35e/0x650 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_noprof+0x677/0x840 mm/slub.c:5556 _kmalloc_noprof include/linux/slab.h:995 [inline] _kzalloc_noprof include/linux/slab.h:1312 [inline] security_inode_init_security+0x113/0x370 security/security.c:1361 shmem_mknod+0x2ce/0x480 mm/shmem.c:4095 vfs_mknod+0x3ae/0x840 fs/namei.c:5287 handle_create drivers/base/devtmpfs.c:283 [inline] handle drivers/base/devtmpfs.c:435 [inline] devtmpfs_work_loop+0x4a3/0xaed drivers/base/devtmpfs.c:450 devtmpfsd+0x3f/0x50 drivers/base/devtmpfs.c:492 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 page_owner free stack trace missing Memory state around the buggy address: ffff888044071100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888044071180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888044071200: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888044071280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888044071300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ================================================================== ---------------- Code disassembly (best guess): 0: 57 push %rdi 1: 56 push %rsi 2: 53 push %rbx 3: 8b 44 24 14 mov 0x14(%rsp),%eax 7: f6 00 08 testb $0x8,(%rax) a: 75 23 jne 0x2f c: 8b 44 24 18 mov 0x18(%rsp),%eax 10: 8b 5c 24 1c mov 0x1c(%rsp),%ebx 14: 8b 4c 24 20 mov 0x20(%rsp),%ecx 18: 8b 54 24 24 mov 0x24(%rsp),%edx 1c: 8b 74 24 28 mov 0x28(%rsp),%esi 20: 8b 7c 24 2c mov 0x2c(%rsp),%edi 24: 8b 6c 24 30 mov 0x30(%rsp),%ebp 28: cd 80 int $0x80 * 2a: 5b pop %rbx <-- trapping instruction 2b: 5e pop %rsi 2c: 5f pop %rdi 2d: 5d pop %rbp 2e: c3 ret 2f: 5b pop %rbx 30: 5e pop %rsi 31: 5f pop %rdi 32: 5d pop %rbp 33: e9 f7 a1 ff ff jmp 0xffffa22f 38: 66 90 xchg %ax,%ax 3a: 66 90 xchg %ax,%ax 3c: 66 90 xchg %ax,%ax 3e: 90 nop 3f: 53 push %rbx