KASAN: use-after-free Read in pci_match_device

Status: premoderation: reported syz repro on 2026/10/02 22:43
Reported-by: syzbot+c85b166dea8d8ecd9010@syzkaller.appspotmail.com
First crash: 7d06h, last: 7d06h

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in strcmp+0x6c/0xb0 lib/string.c:387
Read of size 1 at addr ffff88811a323579 by task syz.1.11152/22939

CPU: 0 PID: 22939 Comm: syz.1.11152 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/16/2026
Call Trace:
 __dump_stack+0x21/0x24 lib/dump_stack.c:77
 dump_stack_lvl+0x1a7/0x208 lib/dump_stack.c:118
 print_address_description+0x7f/0x2c0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:435 [inline]
 kasan_report+0x100/0x140 mm/kasan/report.c:452
 __asan_report_load1_noabort+0x14/0x20 mm/kasan/report_generic.c:306
 strcmp+0x6c/0xb0 lib/string.c:387
 pci_match_device+0x84/0xa70 drivers/pci/pci-driver.c:260
 pci_bus_match+0x55/0x90 drivers/pci/pci-driver.c:1466
 driver_match_device drivers/base/base.h:143 [inline]
 bind_store+0x33f/0x3c0 drivers/base/bus.c:215
 drv_attr_store+0x79/0xa0 drivers/base/bus.c:77
 sysfs_kf_write+0x129/0x150 fs/sysfs/file.c:143
 kernfs_fop_write_iter+0x2bd/0x400 fs/kernfs/file.c:296
 call_write_iter include/linux/fs.h:2072 [inline]
 new_sync_write fs/read_write.c:518 [inline]
 vfs_write+0x770/0xd70 fs/read_write.c:605
 ksys_write+0x14a/0x260 fs/read_write.c:658
 __do_sys_write fs/read_write.c:670 [inline]
 __se_sys_write fs/read_write.c:667 [inline]
 __x64_sys_write+0x7b/0x90 fs/read_write.c:667
 do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7f4267397159
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:00007f42671f8028 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f426761efa0 RCX: 00007f4267397159
RDX: 000000000000000d RSI: 0000200000000800 RDI: 0000000000000007
RBP: 00007f426742e06b R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f426761f038 R14: 00007f426761efa0 R15: 00007ffdc1983cc8

Allocated by task 18713:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:45 [inline]
 set_alloc_info mm/kasan/common.c:430 [inline]
 ____kasan_kmalloc mm/kasan/common.c:509 [inline]
 __kasan_kmalloc+0xd4/0x100 mm/kasan/common.c:518
 kasan_kmalloc include/linux/kasan.h:254 [inline]
 __kmalloc+0x19f/0x330 mm/slub.c:4038
 __kmalloc_node include/linux/slab.h:421 [inline]
 kmalloc_node include/linux/slab.h:578 [inline]
 __vmalloc_area_node mm/vmalloc.c:2520 [inline]
 __vmalloc_node_range+0x294/0x7a0 mm/vmalloc.c:2629
 __vmalloc_node mm/vmalloc.c:2689 [inline]
 vzalloc+0x78/0x90 mm/vmalloc.c:2742
 alloc_counters+0x65/0x540 net/ipv4/netfilter/arp_tables.c:671
 copy_entries_to_user net/ipv6/netfilter/ip6_tables.c:839 [inline]
 get_entries net/ipv6/netfilter/ip6_tables.c:1039 [inline]
 do_ip6t_get_ctl+0xa2d/0x1120 net/ipv6/netfilter/ip6_tables.c:1676
 nf_getsockopt+0x26d/0x290 net/netfilter/nf_sockopt.c:116
 ipv6_getsockopt+0x1b27/0x21f0 net/ipv6/ipv6_sockglue.c:1492
 tcp_getsockopt+0x1e2/0x1ff0 net/ipv4/tcp.c:4049
 sock_common_getsockopt+0x98/0xb0 net/core/sock.c:3298
 __sys_getsockopt+0x201/0x370 net/socket.c:2188
 __do_sys_getsockopt net/socket.c:2203 [inline]
 __se_sys_getsockopt net/socket.c:2200 [inline]
 __x64_sys_getsockopt+0xbf/0xd0 net/socket.c:2200
 do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

Freed by task 22945:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4a/0x70 mm/kasan/common.c:45
 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370
 ____kasan_slab_free+0x125/0x160 mm/kasan/common.c:362
 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:370
 kasan_slab_free include/linux/kasan.h:220 [inline]
 slab_free_hook mm/slub.c:1600 [inline]
 slab_free_freelist_hook+0xc5/0x190 mm/slub.c:1626
 slab_free mm/slub.c:3208 [inline]
 kfree+0xc0/0x270 mm/slub.c:4196
 driver_override_store+0x14f/0x190 drivers/pci/pci-sysfs.c:614
 dev_attr_store+0x5e/0x80 drivers/base/core.c:2018
 sysfs_kf_write+0x129/0x150 fs/sysfs/file.c:143
 kernfs_fop_write_iter+0x2bd/0x400 fs/kernfs/file.c:296
 call_write_iter include/linux/fs.h:2072 [inline]
 new_sync_write fs/read_write.c:518 [inline]
 vfs_write+0x770/0xd70 fs/read_write.c:605
 ksys_write+0x14a/0x260 fs/read_write.c:658
 __do_sys_write fs/read_write.c:670 [inline]
 __se_sys_write fs/read_write.c:667 [inline]
 __x64_sys_write+0x7b/0x90 fs/read_write.c:667
 do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

The buggy address belongs to the object at ffff88811a323578
 which belongs to the cache kmalloc-8 of size 8
The buggy address is located 1 bytes inside of
 8-byte region [ffff88811a323578, ffff88811a323580)
The buggy address belongs to the page:
page:ffffea000468c8c0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x11a323
flags: 0x4000000000000200(slab)
raw: 4000000000000200 dead000000000100 dead000000000122 ffff888100043c80
raw: 0000000000000000 0000000080660066 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 992, ts 314978225379, free_ts 314978178147
 set_page_owner include/linux/page_owner.h:35 [inline]
 post_alloc_hook mm/page_alloc.c:2456 [inline]
 prep_new_page+0x176/0x190 mm/page_alloc.c:2462
 get_page_from_freelist+0x225f/0x23f0 mm/page_alloc.c:4254
 __alloc_pages_nodemask+0x29a/0x640 mm/page_alloc.c:5384
 alloc_slab_page mm/slub.c:-1 [inline]
 allocate_slab mm/slub.c:1813 [inline]
 new_slab+0x84/0x3f0 mm/slub.c:1874
 new_slab_objects mm/slub.c:2632 [inline]
 ___slab_alloc+0x2f8/0x4c0 mm/slub.c:2796
 __slab_alloc+0x63/0xa0 mm/slub.c:2836
 slab_alloc_node mm/slub.c:2918 [inline]
 slab_alloc mm/slub.c:2960 [inline]
 __kmalloc+0x1f9/0x330 mm/slub.c:4034
 kmalloc include/linux/slab.h:560 [inline]
 kernfs_fop_write_iter+0x152/0x400 fs/kernfs/file.c:273
 call_write_iter include/linux/fs.h:2072 [inline]
 new_sync_write fs/read_write.c:518 [inline]
 vfs_write+0x770/0xd70 fs/read_write.c:605
 ksys_write+0x14a/0x260 fs/read_write.c:658
 __do_sys_write fs/read_write.c:670 [inline]
 __se_sys_write fs/read_write.c:667 [inline]
 __x64_sys_write+0x7b/0x90 fs/read_write.c:667
 do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:28 [inline]
 free_pages_prepare mm/page_alloc.c:1349 [inline]
 free_pcp_prepare mm/page_alloc.c:1421 [inline]
 free_unref_page_prepare+0x2b7/0x2d0 mm/page_alloc.c:3336
 free_unref_page mm/page_alloc.c:3391 [inline]
 free_the_page mm/page_alloc.c:5443 [inline]
 __free_pages+0x146/0x390 mm/page_alloc.c:5454
 free_pages+0x82/0x90 mm/page_alloc.c:5465
 selinux_genfs_get_sid+0x20b/0x250 security/selinux/hooks.c:1332
 inode_doinit_with_dentry+0x879/0xd70 security/selinux/hooks.c:1529
 selinux_d_instantiate+0x27/0x40 security/selinux/hooks.c:6395
 security_d_instantiate+0x9e/0xf0 security/security.c:1980
 d_splice_alias+0x6d/0x390 fs/dcache.c:3038
 kernfs_iop_lookup+0x2c5/0x310 fs/kernfs/dir.c:1178
 lookup_open fs/namei.c:3276 [inline]
 open_last_lookups fs/namei.c:3367 [inline]
 path_openat+0x145d/0x3040 fs/namei.c:3556
 do_filp_open+0x1df/0x400 fs/namei.c:3586
 do_sys_openat2+0x19f/0x750 fs/open.c:1219
 do_sys_open fs/open.c:1235 [inline]
 __do_sys_openat fs/open.c:1251 [inline]
 __se_sys_openat fs/open.c:1246 [inline]
 __x64_sys_openat+0x136/0x160 fs/open.c:1246
 do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

Memory state around the buggy address:
 ffff88811a323400: fc fc fb fc fc fc fc fa fc fc fc fc fa fc fc fc
 ffff88811a323480: fc fa fc fc fc fc fa fc fc fc fc fa fc fc fc fc
>ffff88811a323500: fa fc fc fc fc fa fc fc fc fc fa fc fc fc fc fa
                                                                ^
 ffff88811a323580: fc fc fc fc fa fc fc fc fc 00 fc fc fc fc fa fc
 ffff88811a323600: fc fc fc fa fc fc fc fc fb fc fc fc fc fa fc fc
==================================================================
e1000 0000:00:01.0: can't ioremap BAR 0: [??? 0x00000000 flags 0x0]
e1000: probe of 0000:00:01.0 failed with error -5

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/10/02 22:42 android13-5.10-lts df334e630ed3 57bbd979 .config console log report syz / log [disk image] [vmlinux] [kernel image] ci2-android-5-10 KASAN: use-after-free Read in pci_match_device
* Struck through repros no longer work on HEAD.