================================================================== BUG: KASAN: use-after-free in instrument_atomic_read_write include/linux/instrumented.h:101 [inline] BUG: KASAN: use-after-free in atomic_fetch_sub_release include/linux/atomic/atomic-instrumented.h:167 [inline] BUG: KASAN: use-after-free in __refcount_sub_and_test include/linux/refcount.h:272 [inline] BUG: KASAN: use-after-free in __refcount_dec_and_test include/linux/refcount.h:315 [inline] BUG: KASAN: use-after-free in refcount_dec_and_test include/linux/refcount.h:333 [inline] BUG: KASAN: use-after-free in ax25_dev_put include/net/ax25.h:301 [inline] BUG: KASAN: use-after-free in ax25_dev_device_down+0x358/0x680 net/ax25/ax25_dev.c:122 Write of size 4 at addr ffff0000c79962b8 by task syz.6.1773/9605 CPU: 0 PID: 9605 Comm: syz.6.1773 Not tainted 5.15.178-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024 Call trace: dump_backtrace+0x0/0x530 arch/arm64/kernel/stacktrace.c:152 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:216 __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106 print_address_description+0x7c/0x3f0 mm/kasan/report.c:248 __kasan_report mm/kasan/report.c:434 [inline] kasan_report+0x174/0x1e4 mm/kasan/report.c:451 kasan_check_range+0x274/0x2b4 mm/kasan/generic.c:189 __kasan_check_write+0x44/0x54 mm/kasan/shadow.c:37 instrument_atomic_read_write include/linux/instrumented.h:101 [inline] atomic_fetch_sub_release include/linux/atomic/atomic-instrumented.h:167 [inline] __refcount_sub_and_test include/linux/refcount.h:272 [inline] __refcount_dec_and_test include/linux/refcount.h:315 [inline] refcount_dec_and_test include/linux/refcount.h:333 [inline] ax25_dev_put include/net/ax25.h:301 [inline] ax25_dev_device_down+0x358/0x680 net/ax25/ax25_dev.c:122 ax25_device_event+0x534/0x58c net/ax25/af_ax25.c:144 notifier_call_chain kernel/notifier.c:83 [inline] raw_notifier_call_chain+0xd4/0x164 kernel/notifier.c:391 __dev_notify_flags+0x2ac/0x534 dev_change_flags+0xc8/0x154 net/core/dev.c:8897 dev_ifsioc+0x140/0xfe4 net/core/dev_ioctl.c:324 dev_ioctl+0x4e0/0xd3c net/core/dev_ioctl.c:587 sock_do_ioctl+0x1dc/0x2dc net/socket.c:1154 sock_ioctl+0x4f0/0x8ac net/socket.c:1257 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:874 [inline] __se_sys_ioctl fs/ioctl.c:860 [inline] __arm64_sys_ioctl+0x14c/0x1c8 fs/ioctl.c:860 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584 Allocated by task 6431: 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+0xbc/0xfc mm/kasan/common.c:513 __kasan_kmalloc+0x10/0x1c mm/kasan/common.c:522 kasan_kmalloc include/linux/kasan.h:264 [inline] kmem_cache_alloc_trace+0x27c/0x47c mm/slub.c:3247 kmalloc include/linux/slab.h:591 [inline] kzalloc include/linux/slab.h:721 [inline] ax25_dev_device_up+0x5c/0x548 net/ax25/ax25_dev.c:55 ax25_device_event+0x500/0x58c net/ax25/af_ax25.c:139 notifier_call_chain kernel/notifier.c:83 [inline] raw_notifier_call_chain+0xd4/0x164 kernel/notifier.c:391 __dev_notify_flags+0x2ac/0x534 dev_change_flags+0xc8/0x154 net/core/dev.c:8897 dev_ifsioc+0x140/0xfe4 net/core/dev_ioctl.c:324 dev_ioctl+0x4e0/0xd3c net/core/dev_ioctl.c:587 sock_do_ioctl+0x1dc/0x2dc net/socket.c:1154 sock_ioctl+0x4f0/0x8ac net/socket.c:1257 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:874 [inline] __se_sys_ioctl fs/ioctl.c:860 [inline] __arm64_sys_ioctl+0x14c/0x1c8 fs/ioctl.c:860 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584 Freed by task 9605: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4c/0x84 mm/kasan/common.c:46 kasan_set_free_info+0x28/0x4c mm/kasan/generic.c:360 ____kasan_slab_free+0x118/0x164 mm/kasan/common.c:366 __kasan_slab_free+0x18/0x28 mm/kasan/common.c:374 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:1705 [inline] slab_free_freelist_hook+0x128/0x1ec mm/slub.c:1731 slab_free mm/slub.c:3499 [inline] kfree+0x178/0x410 mm/slub.c:4559 ax25_dev_put include/net/ax25.h:302 [inline] ax25_dev_device_down+0x1b0/0x680 net/ax25/ax25_dev.c:119 ax25_device_event+0x534/0x58c net/ax25/af_ax25.c:144 notifier_call_chain kernel/notifier.c:83 [inline] raw_notifier_call_chain+0xd4/0x164 kernel/notifier.c:391 __dev_notify_flags+0x2ac/0x534 dev_change_flags+0xc8/0x154 net/core/dev.c:8897 dev_ifsioc+0x140/0xfe4 net/core/dev_ioctl.c:324 dev_ioctl+0x4e0/0xd3c net/core/dev_ioctl.c:587 sock_do_ioctl+0x1dc/0x2dc net/socket.c:1154 sock_ioctl+0x4f0/0x8ac net/socket.c:1257 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:874 [inline] __se_sys_ioctl fs/ioctl.c:860 [inline] __arm64_sys_ioctl+0x14c/0x1c8 fs/ioctl.c:860 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584 Last potentially related work creation: kasan_save_stack+0x38/0x68 mm/kasan/common.c:38 kasan_record_aux_stack+0xd4/0x11c mm/kasan/generic.c:348 insert_work+0x64/0x394 kernel/workqueue.c:1366 __queue_work+0xb84/0x114c kernel/workqueue.c:1532 rcu_work_rcufn+0x98/0xb4 kernel/workqueue.c:1768 rcu_do_batch kernel/rcu/tree.c:2523 [inline] rcu_core+0x830/0x1b34 kernel/rcu/tree.c:2763 rcu_core_si+0x10/0x1c kernel/rcu/tree.c:2776 handle_softirqs+0x384/0xdbc kernel/softirq.c:558 __do_softirq kernel/softirq.c:592 [inline] do_softirq_own_stack include/asm-generic/softirq_stack.h:10 [inline] do_softirq+0xfc/0x1b0 kernel/softirq.c:459 __local_bh_enable_ip+0x298/0x470 kernel/softirq.c:383 __raw_spin_unlock_bh include/linux/spinlock_api_smp.h:176 [inline] _raw_spin_unlock_bh+0xf8/0x180 kernel/locking/spinlock.c:210 spin_unlock_bh include/linux/spinlock.h:408 [inline] batadv_nc_purge_paths+0x308/0x38c net/batman-adv/network-coding.c:475 batadv_nc_worker+0x2e4/0x580 net/batman-adv/network-coding.c:724 process_one_work+0x790/0x11b8 kernel/workqueue.c:2310 worker_thread+0x910/0x1034 kernel/workqueue.c:2457 kthread+0x37c/0x45c kernel/kthread.c:334 ret_from_fork+0x10/0x20 arch/arm64/kernel/entry.S:870 Second to last potentially related work creation: kasan_save_stack+0x38/0x68 mm/kasan/common.c:38 kasan_record_aux_stack+0xd4/0x11c mm/kasan/generic.c:348 __call_rcu kernel/rcu/tree.c:3007 [inline] call_rcu+0x118/0xb40 kernel/rcu/tree.c:3087 queue_rcu_work+0x88/0xdc kernel/workqueue.c:1788 tcf_queue_work+0xd8/0xf0 net/sched/cls_api.c:205 fw_change+0xd3c/0xfe0 net/sched/cls_fw.c:295 tc_new_tfilter+0xdb0/0x159c net/sched/cls_api.c:2131 rtnetlink_rcv_msg+0xae0/0xdac net/core/rtnetlink.c:5638 netlink_rcv_skb+0x20c/0x3b8 net/netlink/af_netlink.c:2489 rtnetlink_rcv+0x28/0x38 net/core/rtnetlink.c:5665 netlink_unicast_kernel net/netlink/af_netlink.c:1311 [inline] netlink_unicast+0x664/0x938 net/netlink/af_netlink.c:1337 netlink_sendmsg+0x844/0xb38 net/netlink/af_netlink.c:1905 sock_sendmsg_nosec net/socket.c:704 [inline] __sock_sendmsg net/socket.c:716 [inline] ____sys_sendmsg+0x584/0x870 net/socket.c:2436 ___sys_sendmsg+0x214/0x294 net/socket.c:2490 __sys_sendmmsg+0x23c/0x648 net/socket.c:2576 __do_sys_sendmmsg net/socket.c:2605 [inline] __se_sys_sendmmsg net/socket.c:2602 [inline] __arm64_sys_sendmmsg+0xa0/0xbc net/socket.c:2602 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584 The buggy address belongs to the object at ffff0000c7996200 which belongs to the cache kmalloc-256 of size 256 The buggy address is located 184 bytes inside of 256-byte region [ffff0000c7996200, ffff0000c7996300) The buggy address belongs to the page: page:00000000e1e907f7 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x107996 head:00000000e1e907f7 order:1 compound_mapcount:0 flags: 0x5ffc00000010200(slab|head|node=0|zone=2|lastcpupid=0x7ff) raw: 05ffc00000010200 fffffc00033d4f00 0000000c0000000c ffff0000c0002480 raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff0000c7996180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff0000c7996200: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff0000c7996280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff0000c7996300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff0000c7996380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ================================================================== ------------[ cut here ]------------ refcount_t: underflow; use-after-free. WARNING: CPU: 0 PID: 9605 at lib/refcount.c:28 refcount_warn_saturate+0x1c8/0x20c lib/refcount.c:28 Modules linked in: CPU: 0 PID: 9605 Comm: syz.6.1773 Tainted: G B 5.15.178-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024 pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : refcount_warn_saturate+0x1c8/0x20c lib/refcount.c:28 lr : refcount_warn_saturate+0x1c8/0x20c lib/refcount.c:28 sp : ffff800020f77600 x29: ffff800020f77600 x28: ffff800016df13c0 x27: 1fffe00018f32c42 x26: ffff80001bc02000 x25: 1fffe0001a90e86d x24: dfff800000000000 x23: 0000000000000001 x22: ffff0000c79962b8 x21: 0000000000000003 x20: ffff0000c79962b8 x19: ffff800016fd0000 x18: 1fffe0003682eb8e x17: 1fffe0003682eb8e x16: ffff800011b4e3fc x15: ffff800014c0fac0 x14: ffff0001b4175c80 x13: ffff0001b4175c7c x12: 0000000000080000 x11: 000000000005054b x10: ffff80002ceee000 x9 : 91f0ecf889022000 x8 : 91f0ecf889022000 x7 : 0000000000000000 x6 : ffff80000826abe0 x5 : 0000000000000000 x4 : 0000000000000000 x3 : ffff8000085568c0 x2 : 0000000000000001 x1 : 0000000100000000 x0 : 0000000000000026 Call trace: refcount_warn_saturate+0x1c8/0x20c lib/refcount.c:28 ax25_dev_device_down+0x52c/0x680 ax25_device_event+0x534/0x58c net/ax25/af_ax25.c:144 notifier_call_chain kernel/notifier.c:83 [inline] raw_notifier_call_chain+0xd4/0x164 kernel/notifier.c:391 __dev_notify_flags+0x2ac/0x534 dev_change_flags+0xc8/0x154 net/core/dev.c:8897 dev_ifsioc+0x140/0xfe4 net/core/dev_ioctl.c:324 dev_ioctl+0x4e0/0xd3c net/core/dev_ioctl.c:587 sock_do_ioctl+0x1dc/0x2dc net/socket.c:1154 sock_ioctl+0x4f0/0x8ac net/socket.c:1257 vfs_ioctl fs/ioctl.c:51 [inline] __do_sys_ioctl fs/ioctl.c:874 [inline] __se_sys_ioctl fs/ioctl.c:860 [inline] __arm64_sys_ioctl+0x14c/0x1c8 fs/ioctl.c:860 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:52 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142 do_el0_svc+0x58/0x14c arch/arm64/kernel/syscall.c:181 el0_svc+0x7c/0x1f0 arch/arm64/kernel/entry-common.c:608 el0t_64_sync_handler+0x84/0xe4 arch/arm64/kernel/entry-common.c:626 el0t_64_sync+0x1a0/0x1a4 arch/arm64/kernel/entry.S:584 irq event stamp: 1300 hardirqs last enabled at (1299): [] kasan_quarantine_put+0xdc/0x204 mm/kasan/quarantine.c:231 hardirqs last disabled at (1300): [] __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:108 [inline] hardirqs last disabled at (1300): [] _raw_spin_lock_irqsave+0xfc/0x14c kernel/locking/spinlock.c:162 softirqs last enabled at (1294): [] spin_unlock_bh include/linux/spinlock.h:408 [inline] softirqs last enabled at (1294): [] ax25_dev_device_down+0x168/0x680 net/ax25/ax25_dev.c:118 softirqs last disabled at (1292): [] spin_lock_bh include/linux/spinlock.h:368 [inline] softirqs last disabled at (1292): [] ax25_dev_device_down+0x64/0x680 net/ax25/ax25_dev.c:103 ---[ end trace d54633122577c9ae ]---