================================================================== BUG: KASAN: use-after-free in nf_hook_entries_grow+0x68f/0x780 net/netfilter/core.c:142 net/netfilter/core.c:142 Read of size 4 at addr ffff88801d6b7cb8 by task syz-executor103/3616 CPU: 0 PID: 3616 Comm: syz-executor103 Not tainted 5.16.0-rc5-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 lib/dump_stack.c:88 [inline] lib/dump_stack.c:106 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 lib/dump_stack.c:106 print_address_description.constprop.0.cold+0x8d/0x320 mm/kasan/report.c:247 mm/kasan/report.c:247 __kasan_report mm/kasan/report.c:433 [inline] __kasan_report mm/kasan/report.c:433 [inline] mm/kasan/report.c:450 kasan_report.cold+0x83/0xdf mm/kasan/report.c:450 mm/kasan/report.c:450 nf_hook_entries_grow+0x68f/0x780 net/netfilter/core.c:142 net/netfilter/core.c:142 __nf_register_net_hook+0x128/0x6e0 net/netfilter/core.c:429 net/netfilter/core.c:429 nf_register_net_hook+0x114/0x170 net/netfilter/core.c:571 net/netfilter/core.c:571 nft_register_flowtable_net_hooks+0x538/0x7b0 net/netfilter/nf_tables_api.c:7232 net/netfilter/nf_tables_api.c:7232 nf_tables_newflowtable+0x1612/0x1fe0 net/netfilter/nf_tables_api.c:7430 net/netfilter/nf_tables_api.c:7430 nfnetlink_rcv_batch+0x1710/0x25f0 net/netfilter/nfnetlink.c:513 net/netfilter/nfnetlink.c:513 nfnetlink_rcv_skb_batch net/netfilter/nfnetlink.c:634 [inline] nfnetlink_rcv_skb_batch net/netfilter/nfnetlink.c:634 [inline] net/netfilter/nfnetlink.c:652 nfnetlink_rcv+0x3af/0x420 net/netfilter/nfnetlink.c:652 net/netfilter/nfnetlink.c:652 netlink_unicast_kernel net/netlink/af_netlink.c:1315 [inline] netlink_unicast_kernel net/netlink/af_netlink.c:1315 [inline] net/netlink/af_netlink.c:1341 netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1341 net/netlink/af_netlink.c:1341 netlink_sendmsg+0x904/0xdf0 net/netlink/af_netlink.c:1917 net/netlink/af_netlink.c:1917 sock_sendmsg_nosec net/socket.c:704 [inline] sock_sendmsg_nosec net/socket.c:704 [inline] net/socket.c:724 sock_sendmsg+0xcf/0x120 net/socket.c:724 net/socket.c:724 ____sys_sendmsg+0x6e8/0x810 net/socket.c:2409 net/socket.c:2409 ___sys_sendmsg+0xf3/0x170 net/socket.c:2463 net/socket.c:2463 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2492 net/socket.c:2492 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_x64 arch/x86/entry/common.c:50 [inline] arch/x86/entry/common.c:80 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f4231d3dd09 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 41 15 00 00 90 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 c0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ffe28e7e118 EFLAGS: 00000246 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007f4231d3dd09 RDX: 0000000000000000 RSI: 0000000020000100 RDI: 0000000000000003 RBP: 0000000000000000 R08: 000000000000000d R09: 000000000000000d R10: 000000000000000d R11: 0000000000000246 R12: 00007ffe28e7e130 R13: 00000000000f4240 R14: 000000000000d157 R15: 00007ffe28e7e124 Allocated by task 3615: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 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_set_track mm/kasan/common.c:46 [inline] mm/kasan/common.c:522 set_alloc_info mm/kasan/common.c:434 [inline] mm/kasan/common.c:522 ____kasan_kmalloc mm/kasan/common.c:513 [inline] mm/kasan/common.c:522 ____kasan_kmalloc mm/kasan/common.c:472 [inline] mm/kasan/common.c:522 __kasan_kmalloc+0xa9/0xd0 mm/kasan/common.c:522 mm/kasan/common.c:522 kmalloc include/linux/slab.h:590 [inline] kmalloc include/linux/slab.h:590 [inline] net/netfilter/nf_tables_api.c:1806 nft_netdev_hook_alloc+0x8f/0x1a0 net/netfilter/nf_tables_api.c:1806 net/netfilter/nf_tables_api.c:1806 nf_tables_parse_netdev_hooks+0x15b/0x610 net/netfilter/nf_tables_api.c:1860 net/netfilter/nf_tables_api.c:1860 nft_flowtable_parse_hook+0x289/0x7b0 net/netfilter/nf_tables_api.c:7136 net/netfilter/nf_tables_api.c:7136 nf_tables_newflowtable+0x14b5/0x1fe0 net/netfilter/nf_tables_api.c:7421 net/netfilter/nf_tables_api.c:7421 nfnetlink_rcv_batch+0x1710/0x25f0 net/netfilter/nfnetlink.c:513 net/netfilter/nfnetlink.c:513 nfnetlink_rcv_skb_batch net/netfilter/nfnetlink.c:634 [inline] nfnetlink_rcv_skb_batch net/netfilter/nfnetlink.c:634 [inline] net/netfilter/nfnetlink.c:652 nfnetlink_rcv+0x3af/0x420 net/netfilter/nfnetlink.c:652 net/netfilter/nfnetlink.c:652 netlink_unicast_kernel net/netlink/af_netlink.c:1315 [inline] netlink_unicast_kernel net/netlink/af_netlink.c:1315 [inline] net/netlink/af_netlink.c:1341 netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1341 net/netlink/af_netlink.c:1341 netlink_sendmsg+0x904/0xdf0 net/netlink/af_netlink.c:1917 net/netlink/af_netlink.c:1917 sock_sendmsg_nosec net/socket.c:704 [inline] sock_sendmsg_nosec net/socket.c:704 [inline] net/socket.c:724 sock_sendmsg+0xcf/0x120 net/socket.c:724 net/socket.c:724 ____sys_sendmsg+0x6e8/0x810 net/socket.c:2409 net/socket.c:2409 ___sys_sendmsg+0xf3/0x170 net/socket.c:2463 net/socket.c:2463 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2492 net/socket.c:2492 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_x64 arch/x86/entry/common.c:50 [inline] arch/x86/entry/common.c:80 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Freed by task 3615: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 mm/kasan/common.c:38 kasan_set_track+0x21/0x30 mm/kasan/common.c:46 mm/kasan/common.c:46 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370 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 mm/kasan/common.c:366 [inline] mm/kasan/common.c:374 ____kasan_slab_free mm/kasan/common.c:328 [inline] mm/kasan/common.c:374 __kasan_slab_free+0xff/0x130 mm/kasan/common.c:374 mm/kasan/common.c:374 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:1723 [inline] kasan_slab_free include/linux/kasan.h:235 [inline] mm/slub.c:1749 slab_free_hook mm/slub.c:1723 [inline] mm/slub.c:1749 slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1749 mm/slub.c:1749 slab_free mm/slub.c:3513 [inline] slab_free mm/slub.c:3513 [inline] mm/slub.c:4561 kfree+0xf6/0x560 mm/slub.c:4561 mm/slub.c:4561 nf_tables_flowtable_destroy+0x1ef/0x390 net/netfilter/nf_tables_api.c:7818 net/netfilter/nf_tables_api.c:7818 __nft_release_table+0x5f6/0xcd0 net/netfilter/nf_tables_api.c:9621 net/netfilter/nf_tables_api.c:9621 nft_rcv_nl_event+0x4f8/0x670 net/netfilter/nf_tables_api.c:9688 net/netfilter/nf_tables_api.c:9688 notifier_call_chain+0xb5/0x200 kernel/notifier.c:83 kernel/notifier.c:83 blocking_notifier_call_chain kernel/notifier.c:318 [inline] blocking_notifier_call_chain kernel/notifier.c:318 [inline] kernel/notifier.c:306 blocking_notifier_call_chain+0x67/0x90 kernel/notifier.c:306 kernel/notifier.c:306 netlink_release+0xcb6/0x1db0 net/netlink/af_netlink.c:786 net/netlink/af_netlink.c:786 __sock_release+0xcd/0x280 net/socket.c:649 net/socket.c:649 sock_close+0x18/0x20 net/socket.c:1314 net/socket.c:1314 __fput+0x286/0x9f0 fs/file_table.c:280 fs/file_table.c:280 task_work_run+0xdd/0x1a0 kernel/task_work.c:164 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] tracehook_notify_resume include/linux/tracehook.h:189 [inline] kernel/entry/common.c:207 exit_to_user_mode_loop kernel/entry/common.c:175 [inline] kernel/entry/common.c:207 exit_to_user_mode_prepare+0x27e/0x290 kernel/entry/common.c:207 kernel/entry/common.c:207 __syscall_exit_to_user_mode_work kernel/entry/common.c:289 [inline] __syscall_exit_to_user_mode_work kernel/entry/common.c:289 [inline] kernel/entry/common.c:300 syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:300 kernel/entry/common.c:300 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x44/0xae The buggy address belongs to the object at ffff88801d6b7c80 which belongs to the cache kmalloc-96 of size 96 The buggy address is located 56 bytes inside of 96-byte region [ffff88801d6b7c80, ffff88801d6b7ce0) The buggy address belongs to the page: page:ffffea000075adc0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1d6b7 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffffea000046c600 dead000000000003 ffff888010c41780 raw: 0000000000000000 0000000080200020 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY), pid 54, ts 8766572207, free_ts 0 prep_new_page mm/page_alloc.c:2418 [inline] prep_new_page mm/page_alloc.c:2418 [inline] mm/page_alloc.c:4149 get_page_from_freelist+0xa72/0x2f50 mm/page_alloc.c:4149 mm/page_alloc.c:4149 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5369 mm/page_alloc.c:5369 alloc_pages+0x1a7/0x300 mm/mempolicy.c:2191 mm/mempolicy.c:2191 alloc_slab_page mm/slub.c:1793 [inline] allocate_slab mm/slub.c:1930 [inline] alloc_slab_page mm/slub.c:1793 [inline] mm/slub.c:1993 allocate_slab mm/slub.c:1930 [inline] mm/slub.c:1993 new_slab+0x32d/0x4a0 mm/slub.c:1993 mm/slub.c:1993 ___slab_alloc+0x918/0xfe0 mm/slub.c:3022 mm/slub.c:3022 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3109 mm/slub.c:3109 slab_alloc_node mm/slub.c:3200 [inline] slab_alloc mm/slub.c:3242 [inline] slab_alloc_node mm/slub.c:3200 [inline] mm/slub.c:3259 slab_alloc mm/slub.c:3242 [inline] mm/slub.c:3259 kmem_cache_alloc_trace+0x289/0x2c0 mm/slub.c:3259 mm/slub.c:3259 kmalloc include/linux/slab.h:590 [inline] kzalloc include/linux/slab.h:724 [inline] class_dir_create_and_add drivers/base/core.c:2939 [inline] kmalloc include/linux/slab.h:590 [inline] drivers/base/core.c:3003 kzalloc include/linux/slab.h:724 [inline] drivers/base/core.c:3003 class_dir_create_and_add drivers/base/core.c:2939 [inline] drivers/base/core.c:3003 get_device_parent+0x314/0x590 drivers/base/core.c:3003 drivers/base/core.c:3003 device_add+0x2a8/0x1ee0 drivers/base/core.c:3315 drivers/base/core.c:3315 device_create_groups_vargs+0x203/0x280 drivers/base/core.c:4052 drivers/base/core.c:4052 device_create+0xdf/0x120 drivers/base/core.c:4094 drivers/base/core.c:4094 sg_add_device+0x623/0xb10 drivers/scsi/sg.c:1529 drivers/scsi/sg.c:1529 device_add+0xeaf/0x1ee0 drivers/base/core.c:3418 drivers/base/core.c:3418 scsi_sysfs_add_sdev+0x208/0x510 drivers/scsi/scsi_sysfs.c:1377 drivers/scsi/scsi_sysfs.c:1377 scsi_sysfs_add_devices drivers/scsi/scsi_scan.c:1743 [inline] scsi_finish_async_scan drivers/scsi/scsi_scan.c:1828 [inline] scsi_sysfs_add_devices drivers/scsi/scsi_scan.c:1743 [inline] drivers/scsi/scsi_scan.c:1871 scsi_finish_async_scan drivers/scsi/scsi_scan.c:1828 [inline] drivers/scsi/scsi_scan.c:1871 do_scan_async+0x210/0x500 drivers/scsi/scsi_scan.c:1871 drivers/scsi/scsi_scan.c:1871 async_run_entry_fn+0x9d/0x550 kernel/async.c:127 kernel/async.c:127 page_owner free stack trace missing Memory state around the buggy address: ffff88801d6b7b80: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc ffff88801d6b7c00: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc >ffff88801d6b7c80: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ^ ffff88801d6b7d00: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc ffff88801d6b7d80: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc ==================================================================