==================================================================
BUG: KASAN: use-after-free in __tcp_hdrlen include/linux/tcp.h:31 [inline]
BUG: KASAN: use-after-free in qdisc_pkt_len_segs_init+0xa51/0xb30 net/core/dev.c:4140
Read of size 2 at addr ffff8881497c6434 by task syz.8.17349/12754
CPU: 3 UID: 0 PID: 12754 Comm: syz.8.17349 Tainted: G L syzkaller #0 PREEMPT(full)
Tainted: [L]=SOFTLOCKUP
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
Call Trace:
__dump_stack lib/dump_stack.c:94 [inline]
dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120
print_address_description mm/kasan/report.c:378 [inline]
print_report+0x13d/0x4b0 mm/kasan/report.c:482
kasan_report+0xdf/0x1d0 mm/kasan/report.c:595
__tcp_hdrlen include/linux/tcp.h:31 [inline]
qdisc_pkt_len_segs_init+0xa51/0xb30 net/core/dev.c:4140
__dev_queue_xmit+0x270/0x4950 net/core/dev.c:4782
dev_queue_xmit include/linux/netdevice.h:3418 [inline]
hsr_xmit net/hsr/hsr_forward.c:440 [inline]
hsr_forward_do net/hsr/hsr_forward.c:581 [inline]
hsr_forward_skb+0xdcf/0x28a0 net/hsr/hsr_forward.c:743
hsr_handle_frame+0x82f/0xac0 net/hsr/hsr_slave.c:81
__netif_receive_skb_core.constprop.0+0x6c5/0x3530 net/core/dev.c:6089
__netif_receive_skb_list_core+0x353/0x940 net/core/dev.c:6277
__netif_receive_skb_list net/core/dev.c:6344 [inline]
netif_receive_skb_list_internal+0x722/0xd40 net/core/dev.c:6435
gro_normal_list include/net/gro.h:523 [inline]
gro_normal_list include/net/gro.h:519 [inline]
gro_flush_normal include/net/gro.h:531 [inline]
napi_complete_done+0x221/0x940 net/core/dev.c:6803
gro_cell_poll+0x46e/0x690 net/core/gro_cells.c:74
__napi_poll.constprop.0+0xaf/0x450 net/core/dev.c:7730
napi_poll net/core/dev.c:7793 [inline]
net_rx_action+0xa40/0xf20 net/core/dev.c:7950
handle_softirqs+0x1ea/0xa00 kernel/softirq.c:622
do_softirq kernel/softirq.c:523 [inline]
do_softirq+0xac/0xe0 kernel/softirq.c:510
__local_bh_enable_ip+0xf8/0x120 kernel/softirq.c:450
local_bh_enable include/linux/bottom_half.h:33 [inline]
tun_rx_batched.isra.0+0x407/0x750 drivers/net/tun.c:1512
tun_get_user+0x1e31/0x3c20 drivers/net/tun.c:1955
tun_chr_write_iter+0xdc/0x200 drivers/net/tun.c:2001
new_sync_write fs/read_write.c:595 [inline]
vfs_write+0x6ac/0x1070 fs/read_write.c:688
ksys_write+0x12a/0x250 fs/read_write.c:740
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x10b/0xf80 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7fd6d899cdd9
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 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 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fd6d9849028 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007fd6d8c15fa0 RCX: 00007fd6d899cdd9
RDX: 000000000000007a RSI: 0000200000000400 RDI: 0000000000000004
RBP: 00007fd6d8a32d69 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fd6d8c16038 R14: 00007fd6d8c15fa0 R15: 00007ffde2c14bc8
The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x200000959 pfn:0x1497c6
flags: 0x57ff00000000000(node=1|zone=2|lastcpupid=0x7ff)
raw: 057ff00000000000 dead000000000100 dead000000000122 0000000000000000
raw: 0000000200000959 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as freed
page last allocated via order 0, migratetype Movable, gfp_mask 0x140dca(GFP_HIGHUSER_MOVABLE|__GFP_ZERO|__GFP_COMP), pid 12296, tgid 12295 (syz.8.17150), ts 486022686855, free_ts 486718987080
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0x153/0x170 mm/page_alloc.c:1858
prep_new_page mm/page_alloc.c:1866 [inline]
get_page_from_freelist+0x11a6/0x33b0 mm/page_alloc.c:3946
__alloc_frozen_pages_noprof+0x27c/0x2bc0 mm/page_alloc.c:5226
alloc_pages_mpol+0x1fb/0x540 mm/mempolicy.c:2490
folio_alloc_mpol_noprof+0x36/0x260 mm/mempolicy.c:2509
vma_alloc_folio_noprof+0xed/0x1d0 mm/mempolicy.c:2544
folio_prealloc mm/memory.c:1191 [inline]
alloc_anon_folio mm/memory.c:5282 [inline]
do_anonymous_page+0xb46/0x2050 mm/memory.c:5376
do_pte_missing mm/memory.c:4548 [inline]
handle_pte_fault mm/memory.c:6411 [inline]
__handle_mm_fault+0x1d2c/0x2a00 mm/memory.c:6549
handle_mm_fault+0x36d/0xa20 mm/memory.c:6718
do_user_addr_fault+0x74c/0x12f0 arch/x86/mm/fault.c:1385
handle_page_fault arch/x86/mm/fault.c:1474 [inline]
exc_page_fault+0x6f/0xd0 arch/x86/mm/fault.c:1527
asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:618
page last free pid 12295 tgid 12295 stack trace:
reset_page_owner include/linux/page_owner.h:25 [inline]
__free_pages_prepare mm/page_alloc.c:1402 [inline]
free_unref_folios+0xa0d/0x16f0 mm/page_alloc.c:3004
folios_put_refs+0x571/0xa90 mm/swap.c:1008
free_pages_and_swap_cache+0x22d/0x3b0 mm/swap_state.c:401
__tlb_batch_free_encoded_pages+0xe9/0x280 mm/mmu_gather.c:138
tlb_batch_pages_flush mm/mmu_gather.c:151 [inline]
tlb_flush_mmu_free mm/mmu_gather.c:417 [inline]
tlb_flush_mmu+0xe9/0x590 mm/mmu_gather.c:424
zap_pte_range mm/memory.c:1957 [inline]
zap_pmd_range mm/memory.c:2004 [inline]
zap_pud_range mm/memory.c:2032 [inline]
zap_p4d_range mm/memory.c:2053 [inline]
__zap_vma_range+0x230e/0x4bf0 mm/memory.c:2093
unmap_vmas+0x299/0x5f0 mm/memory.c:2162
exit_mmap+0x1ef/0xa10 mm/mmap.c:1300
__mmput+0x12a/0x410 kernel/fork.c:1178
mmput+0x67/0x80 kernel/fork.c:1201
exit_mm kernel/exit.c:581 [inline]
do_exit+0x833/0x2a60 kernel/exit.c:963
do_group_exit+0xd5/0x2a0 kernel/exit.c:1117
__do_sys_exit_group kernel/exit.c:1128 [inline]
__se_sys_exit_group kernel/exit.c:1126 [inline]
__x64_sys_exit_group+0x3e/0x50 kernel/exit.c:1126
x64_sys_call+0x102c/0x1530 arch/x86/include/generated/asm/syscalls_64.h:232
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0x10b/0xf80 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
Memory state around the buggy address:
ffff8881497c6300: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff8881497c6380: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
>ffff8881497c6400: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^
ffff8881497c6480: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff8881497c6500: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================