netlink: 20 bytes leftover after parsing attributes in process `syz-executor.5'. ================================================================== BUG: KASAN: use-after-free in free_netdev+0x17d/0x310 net/core/dev.c:9696 Read of size 8 at addr ffff8881bb5a9578 by task syz-executor.5/1611 CPU: 1 PID: 1611 Comm: syz-executor.5 Not tainted 5.4.190-syzkaller-00003-g569d38047a0f #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/29/2022 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x18e/0x1d5 lib/dump_stack.c:118 print_address_description+0x8c/0x630 mm/kasan/report.c:384 __kasan_report+0xf6/0x130 mm/kasan/report.c:516 kasan_report+0x30/0x60 mm/kasan/common.c:653 free_netdev+0x17d/0x310 net/core/dev.c:9696 netdev_run_todo+0xa79/0xc80 net/core/dev.c:9447 rtnl_unlock net/core/rtnetlink.c:112 [inline] rtnetlink_rcv_msg+0xa49/0xb90 net/core/rtnetlink.c:5263 netlink_rcv_skb+0x190/0x3a0 net/netlink/af_netlink.c:2500 netlink_unicast_kernel net/netlink/af_netlink.c:1312 [inline] netlink_unicast+0x771/0x8d0 net/netlink/af_netlink.c:1338 netlink_sendmsg+0x913/0xb90 net/netlink/af_netlink.c:1933 sock_sendmsg_nosec net/socket.c:638 [inline] sock_sendmsg net/socket.c:658 [inline] ____sys_sendmsg+0x4ee/0x7c0 net/socket.c:2287 ___sys_sendmsg net/socket.c:2341 [inline] __sys_sendmsg+0x235/0x2f0 net/socket.c:2387 do_syscall_64+0xcb/0x1c0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x7f262e673109 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f262d7e9168 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 00007f262e785f60 RCX: 00007f262e673109 RDX: 0000000000000000 RSI: 0000000020000180 RDI: 0000000000000003 RBP: 00007f262e6cd05d R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffd54904e8f R14: 00007f262d7e9300 R15: 0000000000022000 Allocated by task 1611: save_stack mm/kasan/common.c:70 [inline] set_track mm/kasan/common.c:78 [inline] __kasan_kmalloc+0x131/0x1e0 mm/kasan/common.c:529 kmalloc include/linux/slab.h:561 [inline] sk_prot_alloc+0xbc/0x3c0 net/core/sock.c:1618 sk_alloc+0x30/0x330 net/core/sock.c:1676 tun_chr_open+0x77/0x490 drivers/net/tun.c:3487 misc_open+0x346/0x3c0 drivers/char/misc.c:141 chrdev_open+0x4ec/0x5b0 fs/char_dev.c:414 do_dentry_open+0x7e3/0xef0 fs/open.c:796 do_last fs/namei.c:3495 [inline] path_openat+0x1464/0x3710 fs/namei.c:3612 do_filp_open+0x19a/0x3a0 fs/namei.c:3642 do_sys_open+0x2e3/0x700 fs/open.c:1113 do_syscall_64+0xcb/0x1c0 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Freed by task 1609: save_stack mm/kasan/common.c:70 [inline] set_track mm/kasan/common.c:78 [inline] kasan_set_free_info mm/kasan/common.c:345 [inline] __kasan_slab_free+0x178/0x240 mm/kasan/common.c:487 slab_free_hook mm/slub.c:1455 [inline] slab_free_freelist_hook+0x80/0x150 mm/slub.c:1494 slab_free mm/slub.c:3080 [inline] kfree+0xc6/0x260 mm/slub.c:4071 sk_prot_free+0xa3/0x160 net/core/sock.c:1659 tun_detach drivers/net/tun.c:748 [inline] tun_chr_close+0xb4/0xd0 drivers/net/tun.c:3523 __fput+0x261/0x680 fs/file_table.c:281 task_work_run+0x186/0x1b0 kernel/task_work.c:113 tracehook_notify_resume include/linux/tracehook.h:188 [inline] exit_to_usermode_loop+0x1ba/0x1d0 arch/x86/entry/common.c:163 prepare_exit_to_usermode+0x17c/0x1d0 arch/x86/entry/common.c:194 entry_SYSCALL_64_after_hwframe+0x44/0xa9 The buggy address belongs to the object at ffff8881bb5a9000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 1400 bytes inside of 2048-byte region [ffff8881bb5a9000, ffff8881bb5a9800) The buggy address belongs to the page: page:ffffea0006ed6a00 refcount:1 mapcount:0 mapping:ffff8881f5c0c000 index:0x0 compound_mapcount: 0 flags: 0x8000000000010200(slab|head) raw: 8000000000010200 dead000000000100 dead000000000122 ffff8881f5c0c000 raw: 0000000000000000 0000000000080008 00000001ffffffff 0000000000000000 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) set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook mm/page_alloc.c:2165 [inline] prep_new_page+0x194/0x380 mm/page_alloc.c:2171 get_page_from_freelist+0x524/0x560 mm/page_alloc.c:3794 __alloc_pages_nodemask+0x2ab/0x6f0 mm/page_alloc.c:4857 alloc_slab_page+0x39/0x3e0 mm/slub.c:343 allocate_slab mm/slub.c:1683 [inline] new_slab+0x97/0x450 mm/slub.c:1749 new_slab_objects mm/slub.c:2506 [inline] ___slab_alloc+0x320/0x4b0 mm/slub.c:2667 __slab_alloc+0x5a/0x90 mm/slub.c:2707 slab_alloc_node mm/slub.c:2792 [inline] slab_alloc mm/slub.c:2837 [inline] __kmalloc+0x197/0x2b0 mm/slub.c:3909 kmalloc include/linux/slab.h:561 [inline] kzalloc include/linux/slab.h:690 [inline] __register_sysctl_table+0xe7/0x11c0 fs/proc/proc_sysctl.c:1331 __devinet_sysctl_register+0x1a4/0x240 net/ipv4/devinet.c:2575 devinet_sysctl_register+0x139/0x1a0 net/ipv4/devinet.c:2615 inetdev_init+0x24d/0x400 net/ipv4/devinet.c:276 inetdev_event+0x1cc/0x1030 net/ipv4/devinet.c:1531 notifier_call_chain kernel/notifier.c:98 [inline] __raw_notifier_call_chain kernel/notifier.c:399 [inline] raw_notifier_call_chain+0x9d/0x110 kernel/notifier.c:406 call_netdevice_notifiers_info net/core/dev.c:1670 [inline] call_netdevice_notifiers_extack net/core/dev.c:1682 [inline] call_netdevice_notifiers net/core/dev.c:1696 [inline] register_netdevice+0xd9e/0x1140 net/core/dev.c:9206 veth_newlink+0x637/0xb00 drivers/net/veth.c:1303 page_owner free stack trace missing Memory state around the buggy address: ffff8881bb5a9400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881bb5a9480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff8881bb5a9500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8881bb5a9580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881bb5a9600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================