================================================================== BUG: KASAN: use-after-free in sixpack_close+0x236/0x270 drivers/net/hamradio/6pack.c:678 Read of size 8 at addr ffff8880804ccc90 by task syz-executor.5/18109 CPU: 0 PID: 18109 Comm: syz-executor.5 Not tainted 5.16.0-rc1-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_address_description.constprop.0.cold+0x8d/0x2ed mm/kasan/report.c:247 __kasan_report mm/kasan/report.c:433 [inline] kasan_report.cold+0x83/0xdf mm/kasan/report.c:450 sixpack_close+0x236/0x270 drivers/net/hamradio/6pack.c:678 tty_ldisc_close+0x110/0x190 drivers/tty/tty_ldisc.c:474 tty_ldisc_kill+0x94/0x150 drivers/tty/tty_ldisc.c:629 tty_ldisc_release+0xe3/0x2a0 drivers/tty/tty_ldisc.c:803 tty_release_struct+0x20/0xe0 drivers/tty/tty_io.c:1706 tty_release+0xc70/0x1200 drivers/tty/tty_io.c:1878 __fput+0x286/0x9f0 fs/file_table.c:280 task_work_run+0xdd/0x1a0 kernel/task_work.c:164 tracehook_notify_resume include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop kernel/entry/common.c:175 [inline] exit_to_user_mode_prepare+0x27e/0x290 kernel/entry/common.c:207 __syscall_exit_to_user_mode_work kernel/entry/common.c:289 [inline] syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:300 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7fd964f2572b Code: 0f 05 48 3d 00 f0 ff ff 77 45 c3 0f 1f 40 00 48 83 ec 18 89 7c 24 0c e8 63 fc ff ff 8b 7c 24 0c 41 89 c0 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 35 44 89 c7 89 44 24 0c e8 a1 fc ff ff 8b 44 RSP: 002b:00007ffe4cf0d950 EFLAGS: 00000293 ORIG_RAX: 0000000000000003 RAX: 0000000000000000 RBX: 0000000000000004 RCX: 00007fd964f2572b RDX: 0000000000000000 RSI: ffffffff89523b41 RDI: 0000000000000003 RBP: 0000000000000001 R08: 0000000000000000 R09: 0000001b2f2252c0 R10: 0000000000001879 R11: 0000000000000293 R12: 00007fd965086b60 R13: 00007fd965086b60 R14: 00007fd965085f60 R15: 00000000000766a3 Allocated by task 18121: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:434 [inline] ____kasan_kmalloc mm/kasan/common.c:513 [inline] ____kasan_kmalloc mm/kasan/common.c:472 [inline] __kasan_kmalloc+0xa6/0xd0 mm/kasan/common.c:522 kmalloc_node include/linux/slab.h:613 [inline] kvmalloc_node+0x61/0x120 mm/util.c:587 kvmalloc include/linux/slab.h:741 [inline] kvzalloc include/linux/slab.h:749 [inline] alloc_netdev_mqs+0x98/0xec0 net/core/dev.c:10828 sixpack_open+0xfa/0xa50 drivers/net/hamradio/6pack.c:558 tty_ldisc_open+0x9b/0x110 drivers/tty/tty_ldisc.c:449 tty_set_ldisc+0x2f1/0x680 drivers/tty/tty_ldisc.c:579 tiocsetd drivers/tty/tty_io.c:2455 [inline] tty_ioctl+0xae0/0x1670 drivers/tty/tty_io.c:2741 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:874 [inline] __se_sys_ioctl fs/ioctl.c:860 [inline] __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:860 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Freed by task 18109: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 kasan_set_track+0x21/0x30 mm/kasan/common.c:46 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370 ____kasan_slab_free mm/kasan/common.c:366 [inline] ____kasan_slab_free mm/kasan/common.c:328 [inline] __kasan_slab_free+0xd1/0x110 mm/kasan/common.c:374 kasan_slab_free include/linux/kasan.h:235 [inline] __cache_free mm/slab.c:3445 [inline] kfree+0x10d/0x2c0 mm/slab.c:3803 kvfree+0x42/0x50 mm/util.c:620 device_release+0x9f/0x240 drivers/base/core.c:2230 kobject_cleanup lib/kobject.c:705 [inline] kobject_release lib/kobject.c:736 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x1c8/0x540 lib/kobject.c:753 netdev_run_todo+0x75a/0xa80 net/core/dev.c:10638 sixpack_close+0x184/0x270 drivers/net/hamradio/6pack.c:675 tty_ldisc_close+0x110/0x190 drivers/tty/tty_ldisc.c:474 tty_ldisc_kill+0x94/0x150 drivers/tty/tty_ldisc.c:629 tty_ldisc_release+0xe3/0x2a0 drivers/tty/tty_ldisc.c:803 tty_release_struct+0x20/0xe0 drivers/tty/tty_io.c:1706 tty_release+0xc70/0x1200 drivers/tty/tty_io.c:1878 __fput+0x286/0x9f0 fs/file_table.c:280 task_work_run+0xdd/0x1a0 kernel/task_work.c:164 tracehook_notify_resume include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop kernel/entry/common.c:175 [inline] exit_to_user_mode_prepare+0x27e/0x290 kernel/entry/common.c:207 __syscall_exit_to_user_mode_work kernel/entry/common.c:289 [inline] syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:300 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x44/0xae The buggy address belongs to the object at ffff8880804cc000 which belongs to the cache kmalloc-cg-4k of size 4096 The buggy address is located 3216 bytes inside of 4096-byte region [ffff8880804cc000, ffff8880804cd000) The buggy address belongs to the page: page:ffffea0002013300 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x804cc head:ffffea0002013300 order:1 compound_mapcount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 ffffea0001e9e188 ffffea0001a32b88 ffff888010c43d00 raw: 0000000000000000 ffff8880804cc000 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 1, migratetype Unmovable, gfp_mask 0x2420c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_COMP|__GFP_THISNODE), pid 2971, ts 453913684307, free_ts 453868374557 prep_new_page mm/page_alloc.c:2418 [inline] get_page_from_freelist+0xa72/0x2f50 mm/page_alloc.c:4149 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5369 __alloc_pages_node include/linux/gfp.h:570 [inline] kmem_getpages mm/slab.c:1377 [inline] cache_grow_begin+0x75/0x470 mm/slab.c:2593 cache_alloc_refill+0x27f/0x380 mm/slab.c:2965 ____cache_alloc mm/slab.c:3048 [inline] ____cache_alloc mm/slab.c:3031 [inline] slab_alloc_node mm/slab.c:3249 [inline] kmem_cache_alloc_node_trace+0x49c/0x5b0 mm/slab.c:3617 __do_kmalloc_node mm/slab.c:3639 [inline] __kmalloc_node+0x38/0x60 mm/slab.c:3647 kmalloc_node include/linux/slab.h:613 [inline] kvmalloc_node+0x61/0x120 mm/util.c:587 kvmalloc include/linux/slab.h:741 [inline] seq_buf_alloc fs/seq_file.c:38 [inline] seq_read_iter+0x7e7/0x1240 fs/seq_file.c:210 kernfs_fop_read_iter+0x44f/0x5f0 fs/kernfs/file.c:241 call_read_iter include/linux/fs.h:2156 [inline] new_sync_read+0x421/0x6e0 fs/read_write.c:400 vfs_read+0x35c/0x600 fs/read_write.c:481 ksys_read+0x12d/0x250 fs/read_write.c:619 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1338 [inline] free_pcp_prepare+0x374/0x870 mm/page_alloc.c:1389 free_unref_page_prepare mm/page_alloc.c:3309 [inline] free_unref_page+0x19/0x690 mm/page_alloc.c:3388 slab_destroy mm/slab.c:1627 [inline] slabs_destroy+0x89/0xc0 mm/slab.c:1647 cache_flusharray mm/slab.c:3418 [inline] ___cache_free+0x4cc/0x610 mm/slab.c:3480 qlink_free mm/kasan/quarantine.c:146 [inline] qlist_free_all+0x4e/0x110 mm/kasan/quarantine.c:165 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:272 __kasan_slab_alloc+0x97/0xb0 mm/kasan/common.c:444 kasan_slab_alloc include/linux/kasan.h:259 [inline] slab_post_alloc_hook mm/slab.h:519 [inline] slab_alloc mm/slab.c:3323 [inline] __do_kmalloc mm/slab.c:3700 [inline] __kmalloc+0x27a/0x4d0 mm/slab.c:3711 kmalloc include/linux/slab.h:595 [inline] kzalloc include/linux/slab.h:724 [inline] tomoyo_encode2.part.0+0xe9/0x3a0 security/tomoyo/realpath.c:45 tomoyo_encode2 security/tomoyo/realpath.c:31 [inline] tomoyo_encode+0x28/0x50 security/tomoyo/realpath.c:80 tomoyo_realpath_from_path+0x186/0x620 security/tomoyo/realpath.c:288 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_perm+0x21b/0x400 security/tomoyo/file.c:822 security_inode_getattr+0xcf/0x140 security/security.c:1334 vfs_getattr fs/stat.c:157 [inline] vfs_fstat+0x43/0xb0 fs/stat.c:182 __do_sys_newfstat+0x81/0x100 fs/stat.c:422 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 Memory state around the buggy address: ffff8880804ccb80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880804ccc00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8880804ccc80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8880804ccd00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8880804ccd80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================