KASAN: use-after-free Read in r1buf_pool_alloc

Status: upstream: reported on 2026/08/05 08:49
Reported-by: syzbot+0b9a3f1ba310f73be3f4@syzkaller.appspotmail.com
First crash: 1d16h, last: 1d16h
Similar bugs (1)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 KASAN: use-after-free Read in r1buf_pool_alloc 19 syz, C 3 18h42m 23h50m 0/3 upstream: reported C repro on 2026/08/06 01:35

Sample crash report:
md: recovery of RAID array md0
md: md0: recovery done.
==================================================================
BUG: KASAN: use-after-free in r1buf_pool_alloc+0x77e/0xcc0 drivers/md/raid1.c:183
Read of size 4 at addr ffff888072dda5e8 by task md0_resync/4600

CPU: 0 PID: 4600 Comm: md0_resync Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/24/2026
Call Trace:
 <TASK>
 dump_stack_lvl+0x188/0x250 lib/dump_stack.c:106
 print_address_description+0x60/0x2d0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0xdf/0x130 mm/kasan/report.c:451
 r1buf_pool_alloc+0x77e/0xcc0 drivers/md/raid1.c:183
 mempool_init_node+0x1e5/0x480 mm/mempool.c:202
 mempool_init+0x36/0x50 mm/mempool.c:231
 init_resync drivers/md/raid1.c:2621 [inline]
 raid1_sync_request+0x2a9/0x2fb0 drivers/md/raid1.c:2671
 md_do_sync+0x3701/0x40f0 drivers/md/md.c:9103
 md_thread+0x27a/0x4e0 drivers/md/md.c:7974
 kthread+0x42e/0x520 kernel/kthread.c:334
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287
 </TASK>

Allocated by task 4561:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 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+0xaf/0xe0 mm/kasan/common.c:522
 kmalloc include/linux/slab.h:607 [inline]
 raid1_reshape+0x785/0x15f0 drivers/md/raid1.c:3296
 chunk_size_store+0x2a1/0x430 drivers/md/md.c:4321
 md_attr_store+0xdd/0x130 drivers/md/md.c:5636
 kernfs_fop_write_iter+0x3a8/0x500 fs/kernfs/file.c:296
 call_write_iter include/linux/fs.h:2173 [inline]
 new_sync_write fs/read_write.c:507 [inline]
 vfs_write+0x748/0xd70 fs/read_write.c:594
 ksys_write+0x153/0x260 fs/read_write.c:647
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

Freed by task 4602:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:46
 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360
 ____kasan_slab_free+0xd5/0x110 mm/kasan/common.c:366
 kasan_slab_free include/linux/kasan.h:230 [inline]
 slab_free_hook mm/slub.c:1710 [inline]
 slab_free_freelist_hook+0xec/0x170 mm/slub.c:1736
 slab_free mm/slub.c:3504 [inline]
 kfree+0xef/0x2a0 mm/slub.c:4564
 raid1_reshape+0x1142/0x15f0 drivers/md/raid1.c:3339
 chunk_size_store+0x2a1/0x430 drivers/md/md.c:4321
 md_attr_store+0xdd/0x130 drivers/md/md.c:5636
 kernfs_fop_write_iter+0x3a8/0x500 fs/kernfs/file.c:296
 call_write_iter include/linux/fs.h:2173 [inline]
 new_sync_write fs/read_write.c:507 [inline]
 vfs_write+0x748/0xd70 fs/read_write.c:594
 ksys_write+0x153/0x260 fs/read_write.c:647
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

The buggy address belongs to the object at ffff888072dda5e0
 which belongs to the cache kmalloc-16 of size 16
The buggy address is located 8 bytes inside of
 16-byte region [ffff888072dda5e0, ffff888072dda5f0)
The buggy address belongs to the page:
page:ffffea0001cb7680 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x72dda
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 0000000000000000 dead000000000122 ffff888016c413c0
raw: 0000000000000000 0000000000800080 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 0x112cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY), pid 4187, ts 87226299192, free_ts 87211483751
 prep_new_page mm/page_alloc.c:2426 [inline]
 get_page_from_freelist+0x24f6/0x2670 mm/page_alloc.c:4192
 __alloc_pages+0x1ee/0x480 mm/page_alloc.c:5501
 __alloc_pages_node include/linux/gfp.h:570 [inline]
 alloc_slab_page mm/slub.c:1782 [inline]
 allocate_slab mm/slub.c:1917 [inline]
 new_slab+0xb6/0x4b0 mm/slub.c:1980
 ___slab_alloc+0x807/0xdd0 mm/slub.c:3013
 __slab_alloc mm/slub.c:3100 [inline]
 slab_alloc_node mm/slub.c:3191 [inline]
 __kmalloc_node+0x142/0x3a0 mm/slub.c:4456
 kmalloc_node include/linux/slab.h:630 [inline]
 kvmalloc_node+0x84/0x130 mm/util.c:619
 xt_jumpstack_alloc net/netfilter/x_tables.c:1377 [inline]
 xt_replace_table+0x160/0x750 net/netfilter/x_tables.c:1416
 __do_replace+0x16f/0xa00 net/ipv6/netfilter/ip6_tables.c:1081
 do_replace net/ipv6/netfilter/ip6_tables.c:1158 [inline]
 do_ip6t_set_ctl+0xaa4/0xd90 net/ipv6/netfilter/ip6_tables.c:1643
 nf_setsockopt+0x25f/0x280 net/netfilter/nf_sockopt.c:101
 ipv6_setsockopt+0x20ba/0x3cc0 net/ipv6/ipv6_sockglue.c:1014
 tcp_setsockopt+0x229/0x1e60 net/ipv4/tcp.c:3722
 __sys_setsockopt+0x2bf/0x3d0 net/socket.c:2213
 __do_sys_setsockopt net/socket.c:2224 [inline]
 __se_sys_setsockopt net/socket.c:2221 [inline]
 __x64_sys_setsockopt+0xb1/0xc0 net/socket.c:2221
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1340 [inline]
 free_pcp_prepare mm/page_alloc.c:1391 [inline]
 free_unref_page_prepare+0x637/0x6c0 mm/page_alloc.c:3317
 free_unref_page+0x8f/0x2a0 mm/page_alloc.c:3396
 qlist_free_all+0x35/0x90 mm/kasan/quarantine.c:176
 kasan_quarantine_reduce+0x150/0x160 mm/kasan/quarantine.c:283
 __kasan_slab_alloc+0x2f/0xc0 mm/kasan/common.c:444
 kasan_slab_alloc include/linux/kasan.h:254 [inline]
 slab_post_alloc_hook+0x4c/0x380 mm/slab.h:519
 slab_alloc_node mm/slub.c:3225 [inline]
 slab_alloc mm/slub.c:3233 [inline]
 kmem_cache_alloc+0x15d/0x280 mm/slub.c:3238
 getname_flags+0xb7/0x4f0 fs/namei.c:138
 user_path_at_empty+0x2a/0x190 fs/namei.c:2890
 user_path_at include/linux/namei.h:57 [inline]
 do_utimes_path fs/utimes.c:94 [inline]
 do_utimes+0x12e/0x2a0 fs/utimes.c:144
 __do_sys_utimensat fs/utimes.c:163 [inline]
 __se_sys_utimensat fs/utimes.c:147 [inline]
 __x64_sys_utimensat+0x15b/0x240 fs/utimes.c:147
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

Memory state around the buggy address:
 ffff888072dda480: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
 ffff888072dda500: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
>ffff888072dda580: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
                                                          ^
 ffff888072dda600: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
 ffff888072dda680: fa fb fc fc fa fb fc fc fa fb fc fc fa fb fc fc
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/08/05 08:49 linux-5.15.y 6e2fd6534337 52aa2820 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: use-after-free Read in r1buf_pool_alloc
* Struck through repros no longer work on HEAD.