================================================================== BUG: KASAN: use-after-free in update_tty_status drivers/net/caif/caif_serial.c:90 [inline] BUG: KASAN: use-after-free in handle_tx+0x5aa/0x610 drivers/net/caif/caif_serial.c:237 Read of size 1 at addr ffff888021153490 by task aoe_tx0/1354 CPU: 0 PID: 1354 Comm: aoe_tx0 Not tainted 5.15.0-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/0x2ed mm/kasan/report.c:247 __kasan_report mm/kasan/report.c:433 [inline] kasan_report.cold+0x83/0xdf mm/kasan/report.c:450 update_tty_status drivers/net/caif/caif_serial.c:90 [inline] handle_tx+0x5aa/0x610 drivers/net/caif/caif_serial.c:237 __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 19991: 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+0xa6/0xd0 mm/kasan/common.c:522 kasan_kmalloc include/linux/kasan.h:269 [inline] kmem_cache_alloc_trace+0x1ea/0x4a0 mm/slab.c:3575 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_sys_openat fs/open.c:1244 [inline] __se_sys_openat fs/open.c:1239 [inline] __x64_sys_openat+0x13f/0x1f0 fs/open.c:1239 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 Last potentially related work creation: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 __kasan_record_aux_stack+0xb5/0xe0 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 exit_task_work include/linux/task_work.h:32 [inline] do_exit+0xc14/0x2b40 kernel/exit.c:832 do_group_exit+0x125/0x310 kernel/exit.c:929 get_signal+0x47d/0x2220 kernel/signal.c:2830 arch_do_signal_or_restart+0x2a9/0x1c40 arch/x86/kernel/signal.c:868 handle_signal_work kernel/entry/common.c:148 [inline] exit_to_user_mode_loop kernel/entry/common.c:172 [inline] exit_to_user_mode_prepare+0x17d/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 Second to last potentially related work creation: kasan_save_stack+0x1e/0x50 mm/kasan/common.c:38 __kasan_record_aux_stack+0xb5/0xe0 mm/kasan/generic.c:348 kvfree_call_rcu+0x74/0x990 kernel/rcu/tree.c:3550 drop_sysctl_table+0x3c0/0x4e0 fs/proc/proc_sysctl.c:1647 unregister_sysctl_table fs/proc/proc_sysctl.c:1685 [inline] unregister_sysctl_table+0xc0/0x190 fs/proc/proc_sysctl.c:1660 __devinet_sysctl_unregister net/ipv4/devinet.c:2604 [inline] devinet_sysctl_unregister net/ipv4/devinet.c:2632 [inline] inetdev_destroy net/ipv4/devinet.c:326 [inline] inetdev_event+0xcaf/0x15d0 net/ipv4/devinet.c:1600 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] unregister_netdevice_many+0x94f/0x1790 net/core/dev.c:11074 ieee80211_remove_interfaces+0x394/0x820 net/mac80211/iface.c:2167 ieee80211_unregister_hw+0x47/0x1f0 net/mac80211/main.c:1391 mac80211_hwsim_del_radio drivers/net/wireless/mac80211_hwsim.c:3583 [inline] hwsim_exit_net+0x50e/0xca0 drivers/net/wireless/mac80211_hwsim.c:4346 ops_exit_list+0xb0/0x160 net/core/net_namespace.c:168 cleanup_net+0x4ea/0xb00 net/core/net_namespace.c:593 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 The buggy address belongs to the object at ffff888021153000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 1168 bytes inside of 2048-byte region [ffff888021153000, ffff888021153800) The buggy address belongs to the page: page:ffffea00008454c0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x21153 flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000200 ffffea0000674488 ffffea000084cc08 ffff888010c40800 raw: 0000000000000000 ffff888021153000 0000000100000001 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 0x2c2220(__GFP_HIGH|__GFP_ATOMIC|__GFP_NOWARN|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_THISNODE), pid 13956, ts 560113504323, free_ts 542009651476 prep_new_page mm/page_alloc.c:2418 [inline] get_page_from_freelist+0xa72/0x2f50 mm/page_alloc.c:4149 __alloc_pages_slowpath.constprop.0+0x2eb/0x20d0 mm/page_alloc.c:4914 __alloc_pages+0x412/0x500 mm/page_alloc.c:5382 __alloc_pages_node include/linux/gfp.h:570 [inline] kmem_getpages mm/slab.c:1377 [inline] cache_grow_begin+0x75/0x470 mm/slab.c:2593 cache_alloc_refill+0x27f/0x380 mm/slab.c:2965 ____cache_alloc mm/slab.c:3048 [inline] ____cache_alloc mm/slab.c:3031 [inline] slab_alloc_node mm/slab.c:3249 [inline] kmem_cache_alloc_node_trace+0x49c/0x5b0 mm/slab.c:3617 __do_kmalloc_node mm/slab.c:3639 [inline] __kmalloc_node_track_caller+0x38/0x60 mm/slab.c:3654 kmalloc_reserve net/core/skbuff.c:354 [inline] __alloc_skb+0xde/0x340 net/core/skbuff.c:426 alloc_skb include/linux/skbuff.h:1120 [inline] nlmsg_new include/net/netlink.h:953 [inline] inet6_ifinfo_notify+0x72/0x150 net/ipv6/addrconf.c:6004 addrconf_notify+0x495/0x1bb0 net/ipv6/addrconf.c:3635 notifier_call_chain+0xb5/0x200 kernel/notifier.c:83 call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:2002 netdev_state_change net/core/dev.c:1393 [inline] netdev_state_change+0x100/0x130 net/core/dev.c:1386 linkwatch_do_dev+0x10e/0x150 net/core/link_watch.c:167 __linkwatch_run_queue+0x233/0x6a0 net/core/link_watch.c:213 linkwatch_event+0x4a/0x60 net/core/link_watch.c:252 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+0x373/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 slab_destroy mm/slab.c:1627 [inline] slabs_destroy+0x89/0xc0 mm/slab.c:1647 cache_flusharray mm/slab.c:3418 [inline] ___cache_free+0x4cc/0x610 mm/slab.c:3480 qlink_free mm/kasan/quarantine.c:146 [inline] qlist_free_all+0x4e/0x110 mm/kasan/quarantine.c:165 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:272 __kasan_slab_alloc+0x97/0xb0 mm/kasan/common.c:444 kasan_slab_alloc include/linux/kasan.h:259 [inline] slab_post_alloc_hook mm/slab.h:519 [inline] slab_alloc mm/slab.c:3323 [inline] kmem_cache_alloc+0x1bc/0x560 mm/slab.c:3507 ext4_alloc_inode+0x1a/0x640 fs/ext4/super.c:1295 alloc_inode+0x61/0x230 fs/inode.c:237 new_inode_pseudo fs/inode.c:946 [inline] new_inode+0x27/0x2f0 fs/inode.c:975 __ext4_new_inode+0x359/0x5ba0 fs/ext4/ialloc.c:960 ext4_symlink+0x485/0xd40 fs/ext4/namei.c:3293 vfs_symlink fs/namei.c:4248 [inline] vfs_symlink+0x45d/0x6c0 fs/namei.c:4233 do_symlinkat+0x261/0x2e0 fs/namei.c:4277 __do_sys_symlink fs/namei.c:4299 [inline] __se_sys_symlink fs/namei.c:4297 [inline] __x64_sys_symlink+0x75/0x90 fs/namei.c:4297 Memory state around the buggy address: ffff888021153380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888021153400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888021153480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888021153500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888021153580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================