================================================================== BUG: KASAN: use-after-free in sixpack_close+0x236/0x270 drivers/net/hamradio/6pack.c:678 Read of size 8 at addr ffff888077d0ac90 by task syz-executor.1/10772 CPU: 0 PID: 10772 Comm: syz-executor.1 Not tainted 5.16.0-rc1-syzkaller #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014 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/0x320 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_fast_syscall_32+0x72/0xf0 arch/x86/entry/common.c:181 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c RIP: 0023:0xf6f27549 Code: 03 74 c0 01 10 05 03 74 b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00 RSP: 002b:00000000ffab9fc0 EFLAGS: 00000282 ORIG_RAX: 0000000000000006 RAX: 0000000000000000 RBX: 0000000000000004 RCX: 0000000000000002 RDX: 0000000000000000 RSI: 00000000f705d000 RDI: 00000000f7083fac RBP: 00000000f705d000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 Allocated by task 10773: 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+0xa9/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 tty_compat_ioctl+0x295/0x410 drivers/tty/tty_io.c:2955 __do_compat_sys_ioctl+0x1c7/0x290 fs/ioctl.c:972 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c Freed by task 10772: 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+0xff/0x130 mm/kasan/common.c:374 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:1723 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1749 slab_free mm/slub.c:3513 [inline] kfree+0xf6/0x560 mm/slub.c:4561 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_fast_syscall_32+0x72/0xf0 arch/x86/entry/common.c:181 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c The buggy address belongs to the object at ffff888077d0a000 which belongs to the cache kmalloc-cg-4k of size 4096 The buggy address is located 3216 bytes inside of 4096-byte region [ffff888077d0a000, ffff888077d0b000) The buggy address belongs to the page: page:ffffea0001df4200 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888077d0c000 pfn:0x77d08 head:ffffea0001df4200 order:3 compound_mapcount:0 compound_pincount:0 memcg:ffff88807941c081 flags: 0x4fff00000010200(slab|head|node=1|zone=1|lastcpupid=0x7ff) raw: 04fff00000010200 ffffea0000607200 dead000000000003 ffff888010c4c140 raw: ffff888077d0c000 0000000080040003 00000001ffffffff ffff88807941c081 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd60c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_RETRY_MAYFAIL|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 3723, ts 357993507934, free_ts 0 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+0x1a7/0x300 mm/mempolicy.c:2191 alloc_slab_page mm/slub.c:1793 [inline] allocate_slab mm/slub.c:1930 [inline] new_slab+0x32d/0x4a0 mm/slub.c:1993 ___slab_alloc+0x918/0xfe0 mm/slub.c:3022 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3109 slab_alloc_node mm/slub.c:3200 [inline] __kmalloc_node+0x2cb/0x390 mm/slub.c:4467 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 rtnl_create_link+0x95a/0xb80 net/core/rtnetlink.c:3183 __rtnl_newlink+0xf73/0x1750 net/core/rtnetlink.c:3448 rtnl_newlink+0x64/0xa0 net/core/rtnetlink.c:3506 rtnetlink_rcv_msg+0x413/0xb80 net/core/rtnetlink.c:5571 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2491 netlink_unicast_kernel net/netlink/af_netlink.c:1319 [inline] netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1345 netlink_sendmsg+0x86d/0xda0 net/netlink/af_netlink.c:1916 page_owner free stack trace missing Memory state around the buggy address: ffff888077d0ab80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888077d0ac00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888077d0ac80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888077d0ad00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888077d0ad80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ================================================================== ---------------- Code disassembly (best guess): 0: 03 74 c0 01 add 0x1(%rax,%rax,8),%esi 4: 10 05 03 74 b8 01 adc %al,0x1b87403(%rip) # 0x1b8740d a: 10 06 adc %al,(%rsi) c: 03 74 b4 01 add 0x1(%rsp,%rsi,4),%esi 10: 10 07 adc %al,(%rdi) 12: 03 74 b0 01 add 0x1(%rax,%rsi,4),%esi 16: 10 08 adc %cl,(%rax) 18: 03 74 d8 01 add 0x1(%rax,%rbx,8),%esi 1c: 00 00 add %al,(%rax) 1e: 00 00 add %al,(%rax) 20: 00 51 52 add %dl,0x52(%rcx) 23: 55 push %rbp 24: 89 e5 mov %esp,%ebp 26: 0f 34 sysenter 28: cd 80 int $0x80 * 2a: 5d pop %rbp <-- trapping instruction 2b: 5a pop %rdx 2c: 59 pop %rcx 2d: c3 retq 2e: 90 nop 2f: 90 nop 30: 90 nop 31: 90 nop 32: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi 39: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi