ubi0: attaching mtd0 ubi0: scanning is finished ubi0: empty MTD device detected ================================================================== BUG: KASAN: slab-use-after-free in notifier_chain_register+0x3ac/0x420 kernel/notifier.c:27 Read of size 4 at addr ffff8880281598d8 by task syz.3.634/8879 CPU: 0 UID: 0 PID: 8879 Comm: syz.3.634 Not tainted 6.13.0-syzkaller-08291-g805ba04cb7cc #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0xc3/0x620 mm/kasan/report.c:489 kasan_report+0xd9/0x110 mm/kasan/report.c:602 notifier_chain_register+0x3ac/0x420 kernel/notifier.c:27 __blocking_notifier_chain_register kernel/notifier.c:264 [inline] blocking_notifier_chain_register+0x76/0xd0 kernel/notifier.c:282 ubi_wl_init+0x1018/0x17b0 drivers/mtd/ubi/wl.c:1960 ubi_attach+0x1cdd/0x4dc0 drivers/mtd/ubi/attach.c:1605 ubi_attach_mtd_dev+0x158f/0x3590 drivers/mtd/ubi/build.c:1004 ctrl_cdev_ioctl+0x339/0x3d0 drivers/mtd/ubi/cdev.c:1043 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:906 [inline] __se_sys_ioctl fs/ioctl.c:892 [inline] __x64_sys_ioctl+0x190/0x200 fs/ioctl.c:892 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f76e018cda9 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 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f76ddff6038 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 00007f76e03a5fa0 RCX: 00007f76e018cda9 RDX: 0000000000000000 RSI: 0000000040186f40 RDI: 0000000000000003 RBP: 00007f76e020e2a0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f76e03a5fa0 R15: 00007ffe2af26d28 Allocated by task 8678: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:377 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:394 kasan_kmalloc include/linux/kasan.h:260 [inline] __do_kmalloc_node mm/slub.c:4294 [inline] __kmalloc_noprof+0x21a/0x4f0 mm/slub.c:4306 kmalloc_noprof include/linux/slab.h:905 [inline] kmalloc_array_noprof include/linux/slab.h:946 [inline] snd_seq_oss_readq_new+0x99/0x2c0 sound/core/seq/oss/seq_oss_readq.c:41 snd_seq_oss_open+0x54b/0xa20 sound/core/seq/oss/seq_oss_init.c:226 odev_open+0x6f/0x90 sound/core/seq/oss/seq_oss.c:128 soundcore_open+0x409/0x580 sound/sound_core.c:594 chrdev_open+0x237/0x6a0 fs/char_dev.c:414 do_dentry_open+0x735/0x1c40 fs/open.c:955 vfs_open+0x82/0x3f0 fs/open.c:1085 do_open fs/namei.c:3828 [inline] path_openat+0x1e88/0x2d80 fs/namei.c:3987 do_filp_open+0x20c/0x470 fs/namei.c:4014 do_sys_openat2+0x17a/0x1e0 fs/open.c:1427 do_sys_open fs/open.c:1442 [inline] __do_sys_openat fs/open.c:1458 [inline] __se_sys_openat fs/open.c:1453 [inline] __x64_sys_openat+0x175/0x210 fs/open.c:1453 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f Freed by task 8671: kasan_save_stack+0x33/0x60 mm/kasan/common.c:47 kasan_save_track+0x14/0x30 mm/kasan/common.c:68 kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:576 poison_slab_object mm/kasan/common.c:247 [inline] __kasan_slab_free+0x51/0x70 mm/kasan/common.c:264 kasan_slab_free include/linux/kasan.h:233 [inline] slab_free_hook mm/slub.c:2353 [inline] slab_free mm/slub.c:4609 [inline] kfree+0x2c4/0x4d0 mm/slub.c:4757 snd_seq_oss_readq_delete+0x36/0x50 sound/core/seq/oss/seq_oss_readq.c:65 free_devinfo+0x8b/0xb0 sound/core/seq/oss/seq_oss_init.c:390 port_delete+0xd5/0x1b0 sound/core/seq/seq_ports.c:262 snd_seq_delete_port+0x291/0x3a0 sound/core/seq/seq_ports.c:290 snd_seq_ioctl_delete_port+0xb6/0x200 sound/core/seq/seq_clientmgr.c:1374 snd_seq_kernel_client_ctl+0x107/0x1c0 sound/core/seq/seq_clientmgr.c:2551 snd_seq_event_port_detach+0xb2/0xf0 sound/core/seq/seq_ports.c:724 delete_port sound/core/seq/oss/seq_oss_init.c:335 [inline] snd_seq_oss_release+0x139/0x180 sound/core/seq/oss/seq_oss_init.c:415 odev_release+0x4c/0x70 sound/core/seq/oss/seq_oss.c:144 __fput+0x3ff/0xb70 fs/file_table.c:450 task_work_run+0x14e/0x250 kernel/task_work.c:227 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline] exit_to_user_mode_loop kernel/entry/common.c:114 [inline] exit_to_user_mode_prepare include/linux/entry-common.h:329 [inline] __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline] syscall_exit_to_user_mode+0x27b/0x2a0 kernel/entry/common.c:218 do_syscall_64+0xda/0x250 arch/x86/entry/common.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff888028158000 which belongs to the cache kmalloc-8k of size 8192 The buggy address is located 6360 bytes inside of freed 8192-byte region [ffff888028158000, ffff88802815a000) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x28158 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 anon flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000040 ffff88801b042280 0000000000000000 dead000000000001 raw: 0000000000000000 0000000000020002 00000000f5000000 0000000000000000 head: 00fff00000000040 ffff88801b042280 0000000000000000 dead000000000001 head: 0000000000000000 0000000000020002 00000000f5000000 0000000000000000 head: 00fff00000000003 ffffea0000a05601 ffffffffffffffff 0000000000000000 head: 0000000000000008 0000000000000000 00000000ffffffff 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), pid 7049, tgid 7048 (syz.3.247), ts 130769231341, free_ts 130707980431 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x181/0x1b0 mm/page_alloc.c:1551 prep_new_page mm/page_alloc.c:1559 [inline] get_page_from_freelist+0xfce/0x2f80 mm/page_alloc.c:3477 __alloc_frozen_pages_noprof+0x221/0x2470 mm/page_alloc.c:4739 alloc_pages_mpol+0x1fc/0x540 mm/mempolicy.c:2270 alloc_slab_page mm/slub.c:2423 [inline] allocate_slab mm/slub.c:2587 [inline] new_slab+0x23d/0x330 mm/slub.c:2640 ___slab_alloc+0xbfa/0x1600 mm/slub.c:3826 __slab_alloc.constprop.0+0x56/0xb0 mm/slub.c:3916 __slab_alloc_node mm/slub.c:3991 [inline] slab_alloc_node mm/slub.c:4152 [inline] __do_kmalloc_node mm/slub.c:4293 [inline] __kmalloc_noprof+0x2de/0x4f0 mm/slub.c:4306 kmalloc_noprof include/linux/slab.h:905 [inline] kmalloc_array_noprof include/linux/slab.h:946 [inline] snd_seq_oss_readq_new+0x99/0x2c0 sound/core/seq/oss/seq_oss_readq.c:41 snd_seq_oss_open+0x54b/0xa20 sound/core/seq/oss/seq_oss_init.c:226 odev_open+0x6f/0x90 sound/core/seq/oss/seq_oss.c:128 soundcore_open+0x409/0x580 sound/sound_core.c:594 chrdev_open+0x237/0x6a0 fs/char_dev.c:414 do_dentry_open+0x735/0x1c40 fs/open.c:955 vfs_open+0x82/0x3f0 fs/open.c:1085 do_open fs/namei.c:3828 [inline] path_openat+0x1e88/0x2d80 fs/namei.c:3987 page last free pid 5823 tgid 5823 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1127 [inline] free_frozen_pages+0x6db/0xfb0 mm/page_alloc.c:2660 __folio_put+0x32a/0x450 mm/swap.c:112 folio_put include/linux/mm.h:1489 [inline] put_page+0x21e/0x280 include/linux/mm.h:1561 skb_page_unref include/linux/skbuff_ref.h:43 [inline] __skb_frag_unref include/linux/skbuff_ref.h:56 [inline] skb_release_data+0x4d7/0x730 net/core/skbuff.c:1119 skb_release_all net/core/skbuff.c:1190 [inline] __kfree_skb+0x4f/0x70 net/core/skbuff.c:1204 tcp_wmem_free_skb include/net/tcp.h:306 [inline] tcp_rtx_queue_unlink_and_free include/net/tcp.h:2091 [inline] tcp_clean_rtx_queue net/ipv4/tcp_input.c:3436 [inline] tcp_ack+0x1eb7/0x5ba0 net/ipv4/tcp_input.c:4032 tcp_rcv_established+0xcf5/0x20d0 net/ipv4/tcp_input.c:6191 tcp_v4_do_rcv+0x5ca/0xa90 net/ipv4/tcp_ipv4.c:1918 sk_backlog_rcv include/net/sock.h:1122 [inline] __release_sock+0x31b/0x400 net/core/sock.c:3106 release_sock+0x5a/0x220 net/core/sock.c:3660 tcp_sendmsg+0x38/0x50 net/ipv4/tcp.c:1359 inet_sendmsg+0xb9/0x140 net/ipv4/af_inet.c:851 sock_sendmsg_nosec net/socket.c:713 [inline] __sock_sendmsg net/socket.c:728 [inline] sock_write_iter+0x4ac/0x5b0 net/socket.c:1132 new_sync_write fs/read_write.c:586 [inline] vfs_write+0x5ae/0x1150 fs/read_write.c:679 ksys_write+0x207/0x250 fs/read_write.c:731 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83 Memory state around the buggy address: ffff888028159780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888028159800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888028159880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888028159900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888028159980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================