================================================================== BUG: KASAN: use-after-free in handle_tx+0x573/0x610 drivers/net/caif/caif_serial.c:236 Read of size 8 at addr ffff888022a22018 by task aoe_tx0/1350 CPU: 1 PID: 1350 Comm: aoe_tx0 Not tainted 5.16.0-rc2-syzkaller #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_address_description.constprop.0.cold+0x8d/0x320 mm/kasan/report.c:247 __kasan_report mm/kasan/report.c:433 [inline] kasan_report.cold+0x83/0xdf mm/kasan/report.c:450 handle_tx+0x573/0x610 drivers/net/caif/caif_serial.c:236 __netdev_start_xmit include/linux/netdevice.h:4987 [inline] netdev_start_xmit include/linux/netdevice.h:5001 [inline] xmit_one net/core/dev.c:3590 [inline] dev_hard_start_xmit+0x1eb/0x920 net/core/dev.c:3606 __dev_queue_xmit+0x299a/0x3630 net/core/dev.c:4226 tx+0x68/0xb0 drivers/block/aoe/aoenet.c:63 kthread+0x1e7/0x3b0 drivers/block/aoe/aoecmd.c:1230 kthread+0x405/0x4f0 kernel/kthread.c:327 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Allocated by task 6036: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 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 mm/kasan/common.c:472 [inline] __kasan_kmalloc+0xa9/0xd0 mm/kasan/common.c:522 kmalloc include/linux/slab.h:590 [inline] kzalloc include/linux/slab.h:724 [inline] alloc_tty_struct+0x94/0x920 drivers/tty/tty_io.c:3122 tty_init_dev.part.0+0x20/0x610 drivers/tty/tty_io.c:1422 tty_init_dev include/linux/err.h:36 [inline] tty_open_by_driver drivers/tty/tty_io.c:2098 [inline] tty_open+0xb16/0x1000 drivers/tty/tty_io.c:2146 chrdev_open+0x266/0x770 fs/char_dev.c:414 do_dentry_open+0x4c8/0x1250 fs/open.c:822 do_open fs/namei.c:3426 [inline] path_openat+0x1cad/0x2750 fs/namei.c:3559 do_filp_open+0x1aa/0x400 fs/namei.c:3586 do_sys_openat2+0x16d/0x4d0 fs/open.c:1212 do_sys_open fs/open.c:1228 [inline] __do_compat_sys_openat fs/open.c:1288 [inline] __se_compat_sys_openat fs/open.c:1286 [inline] __ia32_compat_sys_openat+0x13f/0x1f0 fs/open.c:1286 do_syscall_32_irqs_on arch/x86/entry/common.c:112 [inline] __do_fast_syscall_32+0x65/0xf0 arch/x86/entry/common.c:178 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c Freed by task 3746: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 kasan_set_track+0x21/0x30 mm/kasan/common.c:46 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370 ____kasan_slab_free mm/kasan/common.c:366 [inline] ____kasan_slab_free mm/kasan/common.c:328 [inline] __kasan_slab_free+0xff/0x130 mm/kasan/common.c:374 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:1723 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1749 slab_free mm/slub.c:3513 [inline] kfree+0xf6/0x560 mm/slub.c:4561 process_one_work+0x9b2/0x1690 kernel/workqueue.c:2298 worker_thread+0x658/0x11f0 kernel/workqueue.c:2445 kthread+0x405/0x4f0 kernel/kthread.c:327 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295 Last potentially related work creation: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 __kasan_record_aux_stack+0xf5/0x120 mm/kasan/generic.c:348 insert_work+0x48/0x370 kernel/workqueue.c:1354 __queue_work+0x5ca/0xee0 kernel/workqueue.c:1520 queue_work_on+0xee/0x110 kernel/workqueue.c:1547 kref_put include/linux/kref.h:65 [inline] tty_kref_put drivers/tty/tty_io.c:1581 [inline] release_tty+0x4e9/0x610 drivers/tty/tty_io.c:1618 tty_release_struct+0xb4/0xe0 drivers/tty/tty_io.c:1717 tty_release+0xc70/0x1200 drivers/tty/tty_io.c:1878 __fput+0x286/0x9f0 fs/file_table.c:280 task_work_run+0xdd/0x1a0 kernel/task_work.c:164 tracehook_notify_resume include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop kernel/entry/common.c:175 [inline] exit_to_user_mode_prepare+0x27e/0x290 kernel/entry/common.c:207 __syscall_exit_to_user_mode_work kernel/entry/common.c:289 [inline] syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:300 __do_fast_syscall_32+0x72/0xf0 arch/x86/entry/common.c:181 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:203 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c Second to last potentially related work creation: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 __kasan_record_aux_stack+0xf5/0x120 mm/kasan/generic.c:348 __call_rcu kernel/rcu/tree.c:2985 [inline] call_rcu+0xb1/0x740 kernel/rcu/tree.c:3065 netlink_release+0xdd2/0x1dd0 net/netlink/af_netlink.c:815 __sock_release+0xcd/0x280 net/socket.c:649 sock_close+0x18/0x20 net/socket.c:1314 __fput+0x286/0x9f0 fs/file_table.c:280 task_work_run+0xdd/0x1a0 kernel/task_work.c:164 tracehook_notify_resume include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop kernel/entry/common.c:175 [inline] exit_to_user_mode_prepare+0x27e/0x290 kernel/entry/common.c:207 __syscall_exit_to_user_mode_work kernel/entry/common.c:289 [inline] syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:300 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x44/0xae The buggy address belongs to the object at ffff888022a22000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 24 bytes inside of 2048-byte region [ffff888022a22000, ffff888022a22800) The buggy address belongs to the page: page:ffffea00008a8800 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x22a20 head:ffffea00008a8800 order:3 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 ffffea00004d3a00 dead000000000002 ffff888010c42f00 raw: 0000000000000000 0000000080080008 00000001ffffffff 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 3718, ts 221597145518, free_ts 144247050636 prep_new_page mm/page_alloc.c:2418 [inline] get_page_from_freelist+0xa72/0x2f50 mm/page_alloc.c:4149 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5369 alloc_pages+0x1a7/0x300 mm/mempolicy.c:2191 alloc_slab_page mm/slub.c:1793 [inline] allocate_slab mm/slub.c:1930 [inline] new_slab+0x32d/0x4a0 mm/slub.c:1993 ___slab_alloc+0x918/0xfe0 mm/slub.c:3022 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3109 slab_alloc_node mm/slub.c:3200 [inline] slab_alloc mm/slub.c:3242 [inline] __kmalloc+0x2fb/0x340 mm/slub.c:4419 kmalloc include/linux/slab.h:595 [inline] kzalloc include/linux/slab.h:724 [inline] __register_sysctl_table+0x112/0x1090 fs/proc/proc_sysctl.c:1318 __addrconf_sysctl_register+0x1db/0x3d0 net/ipv6/addrconf.c:7031 addrconf_sysctl_register net/ipv6/addrconf.c:7078 [inline] addrconf_sysctl_register+0x139/0x1d0 net/ipv6/addrconf.c:7067 ipv6_add_dev+0x96d/0x1170 net/ipv6/addrconf.c:455 addrconf_notify+0x60e/0x1bb0 net/ipv6/addrconf.c:3510 notifier_call_chain+0xb5/0x200 kernel/notifier.c:83 call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:2002 call_netdevice_notifiers_extack net/core/dev.c:2014 [inline] call_netdevice_notifiers net/core/dev.c:2028 [inline] register_netdevice+0x1073/0x1500 net/core/dev.c:10364 register_netdev+0x2d/0x50 net/core/dev.c:10457 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1338 [inline] free_pcp_prepare+0x374/0x870 mm/page_alloc.c:1389 free_unref_page_prepare mm/page_alloc.c:3309 [inline] free_unref_page+0x19/0x690 mm/page_alloc.c:3388 skb_free_frag include/linux/skbuff.h:2949 [inline] skb_free_head net/core/skbuff.c:653 [inline] skb_release_data+0x61f/0x790 net/core/skbuff.c:677 skb_release_all net/core/skbuff.c:742 [inline] __kfree_skb+0x46/0x60 net/core/skbuff.c:756 sk_eat_skb include/net/sock.h:2652 [inline] tcp_recvmsg_locked+0x12e8/0x20d0 net/ipv4/tcp.c:2488 tcp_recvmsg+0x12b/0x550 net/ipv4/tcp.c:2534 inet_recvmsg+0x11b/0x5e0 net/ipv4/af_inet.c:850 sock_recvmsg_nosec net/socket.c:944 [inline] sock_recvmsg net/socket.c:962 [inline] sock_recvmsg net/socket.c:958 [inline] sock_read_iter+0x33c/0x470 net/socket.c:1035 call_read_iter include/linux/fs.h:2156 [inline] new_sync_read+0x5ba/0x6e0 fs/read_write.c:400 vfs_read+0x35c/0x600 fs/read_write.c:481 ksys_read+0x1ee/0x250 fs/read_write.c:619 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae Memory state around the buggy address: ffff888022a21f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888022a21f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888022a22000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888022a22080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888022a22100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================