em28xx 1-1:0.0: Disconnecting em28xx
==================================================================
BUG: KASAN: slab-use-after-free in media_devnode_unregister+0xe2/0xf0
Read of size 4 at addr ffff8880242324f0 by task kworker/1:2/794

CPU: 1 UID: 0 PID: 794 Comm: kworker/1:2 Not tainted syzkaller #0 PREEMPT(full) 
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
Workqueue: usb_hub_wq hub_event
Call Trace:
 <TASK>
 dump_stack_lvl+0x189/0x250
 print_report+0xca/0x240
 kasan_report+0x118/0x150
 media_devnode_unregister+0xe2/0xf0
 media_device_unregister+0x37c/0x400
 em28xx_release_resources+0xac/0x240
 em28xx_usb_disconnect+0x19f/0x2f0
 usb_unbind_interface+0x26e/0x910
 device_release_driver_internal+0x4d9/0x800
 bus_remove_device+0x34d/0x410
 device_del+0x511/0x8e0
 usb_disable_device+0x3e9/0x8a0
 usb_disconnect+0x330/0x950
 hub_event+0x1cf5/0x4a20
 process_scheduled_works+0xae1/0x17b0
 worker_thread+0x8a0/0xda0
 kthread+0x711/0x8a0
 ret_from_fork+0x47f/0x820
 ret_from_fork_asm+0x1a/0x30
 </TASK>

Allocated by task 10:
 kasan_save_track+0x3e/0x80
 __kasan_kmalloc+0x93/0xb0
 __kmalloc_cache_noprof+0x3d5/0x6f0
 __media_device_register+0x58/0x280
 em28xx_usb_probe+0x1764/0x2a20
 usb_probe_interface+0x668/0xc30
 really_probe+0x26d/0x9e0
 __driver_probe_device+0x18c/0x2f0
 driver_probe_device+0x4f/0x430
 __device_attach_driver+0x2ce/0x530
 bus_for_each_drv+0x251/0x2e0
 __device_attach+0x2b8/0x400
 bus_probe_device+0x185/0x260
 device_add+0x7b6/0xb50
 usb_set_configuration+0x1a87/0x20e0
 usb_generic_driver_probe+0x8d/0x150
 usb_probe_device+0x1c4/0x390
 really_probe+0x26d/0x9e0
 __driver_probe_device+0x18c/0x2f0
 driver_probe_device+0x4f/0x430
 __device_attach_driver+0x2ce/0x530
 bus_for_each_drv+0x251/0x2e0
 __device_attach+0x2b8/0x400
 bus_probe_device+0x185/0x260
 device_add+0x7b6/0xb50
 usb_new_device+0xa39/0x16f0
 hub_event+0x2958/0x4a20
 process_scheduled_works+0xae1/0x17b0
 worker_thread+0x8a0/0xda0
 kthread+0x711/0x8a0
 ret_from_fork+0x47f/0x820
 ret_from_fork_asm+0x1a/0x30

Freed by task 794:
 kasan_save_track+0x3e/0x80
 __kasan_save_free_info+0x46/0x50
 __kasan_slab_free+0x5b/0x80
 kfree+0x199/0x6d0
 media_devnode_release+0x61/0xa0
 device_release+0x9c/0x1c0
 kobject_put+0x22b/0x480
 media_devnode_unregister+0x6d/0xf0
 media_device_unregister+0x37c/0x400
 em28xx_release_resources+0xac/0x240
 em28xx_usb_disconnect+0x19f/0x2f0
 usb_unbind_interface+0x26e/0x910
 device_release_driver_internal+0x4d9/0x800
 bus_remove_device+0x34d/0x410
 device_del+0x511/0x8e0
 usb_disable_device+0x3e9/0x8a0
 usb_disconnect+0x330/0x950
 hub_event+0x1cf5/0x4a20
 process_scheduled_works+0xae1/0x17b0
 worker_thread+0x8a0/0xda0
 kthread+0x711/0x8a0
 ret_from_fork+0x47f/0x820
 ret_from_fork_asm+0x1a/0x30

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

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff888024235000 pfn:0x24230
head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0xfff00000000240(workingset|head|node=0|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 00fff00000000240 ffff88801a842000 ffffea0000868010 ffffea0000a6c210
raw: ffff888024235000 0000000000080006 00000000f5000000 0000000000000000
head: 00fff00000000240 ffff88801a842000 ffffea0000868010 ffffea0000a6c210
head: ffff888024235000 0000000000080006 00000000f5000000 0000000000000000
head: 00fff00000000003 ffffea0000908c01 00000000ffffffff 00000000ffffffff
head: ffffffffffffffff 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 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5854, tgid 5854 (syz-executor), ts 63785999431, free_ts 63440335572
 post_alloc_hook+0x240/0x2a0
 get_page_from_freelist+0x21e4/0x22c0
 __alloc_frozen_pages_noprof+0x181/0x370
 alloc_pages_mpol+0x232/0x4a0
 allocate_slab+0x8a/0x330
 ___slab_alloc+0xbd1/0x13f0
 __slab_alloc+0x55/0xa0
 __kmalloc_noprof+0x471/0x7f0
 ops_init+0x7b/0x5c0
 setup_net+0x10c/0x320
 copy_net_ns+0x31b/0x4d0
 create_new_namespaces+0x3f3/0x720
 unshare_nsproxy_namespaces+0x11c/0x170
 ksys_unshare+0x4c8/0x8c0
 __x64_sys_unshare+0x38/0x50
 do_syscall_64+0xfa/0xfa0
page last free pid 5843 tgid 5843 stack trace:
 __free_frozen_pages+0xbc4/0xd30
 __slab_free+0x2e7/0x390
 qlist_free_all+0x97/0x140
 kasan_quarantine_reduce+0x148/0x160
 __kasan_slab_alloc+0x22/0x80
 __kmalloc_noprof+0x3c3/0x7f0
 tomoyo_supervisor+0xbd5/0x1480
 tomoyo_path_permission+0x25a/0x380
 tomoyo_check_open_permission+0x2b6/0x3b0
 security_file_open+0xb1/0x270
 do_dentry_open+0x384/0x13f0
 vfs_open+0x3b/0x340
 path_openat+0x2ee5/0x3830
 do_filp_open+0x1fa/0x410
 do_sys_openat2+0x121/0x1c0
 __x64_sys_openat+0x138/0x170

Memory state around the buggy address:
 ffff888024232380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888024232400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888024232480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                             ^
 ffff888024232500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888024232580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
