================================================================== BUG: KASAN: slab-use-after-free in update_tty_status drivers/net/caif/caif_serial.c:90 [inline] BUG: KASAN: slab-use-after-free in handle_tx+0x5dc/0x630 drivers/net/caif/caif_serial.c:223 Read of size 1 at addr ffff88806fc55490 by task aoe_tx0/1418 CPU: 2 UID: 0 PID: 1418 Comm: aoe_tx0 Not tainted syzkaller #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 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+0xcd/0x630 mm/kasan/report.c:482 kasan_report+0xe0/0x110 mm/kasan/report.c:595 update_tty_status drivers/net/caif/caif_serial.c:90 [inline] handle_tx+0x5dc/0x630 drivers/net/caif/caif_serial.c:223 __netdev_start_xmit include/linux/netdevice.h:5273 [inline] netdev_start_xmit include/linux/netdevice.h:5282 [inline] xmit_one net/core/dev.c:3853 [inline] dev_hard_start_xmit+0x97/0x6e0 net/core/dev.c:3869 __dev_queue_xmit+0x6d7/0x4650 net/core/dev.c:4817 dev_queue_xmit include/linux/netdevice.h:3381 [inline] tx+0xcc/0x190 drivers/block/aoe/aoenet.c:62 kthread+0x1e4/0x3e0 drivers/block/aoe/aoecmd.c:1241 kthread+0x3c5/0x780 kernel/kthread.c:463 ret_from_fork+0x983/0xb10 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:246 Allocated by task 10171: kasan_save_stack+0x33/0x60 mm/kasan/common.c:56 kasan_save_track+0x14/0x30 mm/kasan/common.c:77 poison_kmalloc_redzone mm/kasan/common.c:397 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:414 kmalloc_noprof include/linux/slab.h:957 [inline] kzalloc_noprof include/linux/slab.h:1094 [inline] alloc_tty_struct+0x96/0x8c0 drivers/tty/tty_io.c:3102 tty_init_dev.part.0+0x1e/0x500 drivers/tty/tty_io.c:1400 tty_init_dev include/linux/err.h:78 [inline] tty_open_by_driver drivers/tty/tty_io.c:2073 [inline] tty_open+0xa4f/0xf90 drivers/tty/tty_io.c:2120 chrdev_open+0x234/0x6a0 fs/char_dev.c:414 do_dentry_open+0x748/0x1590 fs/open.c:962 vfs_open+0x82/0x3f0 fs/open.c:1094 do_open fs/namei.c:4628 [inline] path_openat+0x2078/0x3140 fs/namei.c:4787 do_filp_open+0x20b/0x470 fs/namei.c:4814 do_sys_openat2+0x121/0x290 fs/open.c:1430 do_sys_open fs/open.c:1436 [inline] __do_compat_sys_openat fs/open.c:1498 [inline] __se_compat_sys_openat fs/open.c:1496 [inline] __ia32_compat_sys_openat+0x16d/0x210 fs/open.c:1496 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:83 [inline] __do_fast_syscall_32+0xe8/0x680 arch/x86/entry/syscall_32.c:307 do_fast_syscall_32+0x32/0x80 arch/x86/entry/syscall_32.c:332 entry_SYSENTER_compat_after_hwframe+0x84/0x8e Freed by task 6027: kasan_save_stack+0x33/0x60 mm/kasan/common.c:56 kasan_save_track+0x14/0x30 mm/kasan/common.c:77 kasan_save_free_info+0x3b/0x60 mm/kasan/generic.c:584 poison_slab_object mm/kasan/common.c:252 [inline] __kasan_slab_free+0x5f/0x80 mm/kasan/common.c:284 kasan_slab_free include/linux/kasan.h:234 [inline] slab_free_hook mm/slub.c:2540 [inline] slab_free mm/slub.c:6668 [inline] kfree+0x2f8/0x6e0 mm/slub.c:6876 process_one_work+0x9ba/0x1b20 kernel/workqueue.c:3257 process_scheduled_works kernel/workqueue.c:3340 [inline] worker_thread+0x6c8/0xf10 kernel/workqueue.c:3421 kthread+0x3c5/0x780 kernel/kthread.c:463 ret_from_fork+0x983/0xb10 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:246 Last potentially related work creation: kasan_save_stack+0x33/0x60 mm/kasan/common.c:56 kasan_record_aux_stack+0xa7/0xc0 mm/kasan/generic.c:556 insert_work+0x36/0x230 kernel/workqueue.c:2180 __queue_work+0x94f/0x10e0 kernel/workqueue.c:2335 queue_work_on+0x1a4/0x1f0 kernel/workqueue.c:2386 kref_put include/linux/kref.h:65 [inline] tty_kref_put drivers/tty/tty_io.c:1557 [inline] tty_kref_put drivers/tty/tty_io.c:1554 [inline] release_tty+0x4de/0x5d0 drivers/tty/tty_io.c:1593 tty_release_struct+0xb7/0xe0 drivers/tty/tty_io.c:1692 tty_release+0xe2d/0x1470 drivers/tty/tty_io.c:1852 __fput+0x402/0xb70 fs/file_table.c:468 task_work_run+0x150/0x240 kernel/task_work.c:233 exit_task_work include/linux/task_work.h:40 [inline] do_exit+0x87f/0x2bd0 kernel/exit.c:971 do_group_exit+0xd3/0x2a0 kernel/exit.c:1112 get_signal+0x2671/0x26d0 kernel/signal.c:3034 arch_do_signal_or_restart+0x8f/0x7a0 arch/x86/kernel/signal.c:337 __exit_to_user_mode_loop kernel/entry/common.c:41 [inline] exit_to_user_mode_loop+0x8c/0x540 kernel/entry/common.c:75 __exit_to_user_mode_prepare include/linux/irq-entry-common.h:226 [inline] syscall_exit_to_user_mode_prepare include/linux/irq-entry-common.h:256 [inline] syscall_exit_to_user_mode_work include/linux/entry-common.h:159 [inline] syscall_exit_to_user_mode include/linux/entry-common.h:194 [inline] __do_fast_syscall_32+0x4a4/0x680 arch/x86/entry/syscall_32.c:310 do_fast_syscall_32+0x32/0x80 arch/x86/entry/syscall_32.c:332 entry_SYSENTER_compat_after_hwframe+0x84/0x8e The buggy address belongs to the object at ffff88806fc55000 which belongs to the cache kmalloc-cg-2k of size 2048 The buggy address is located 1168 bytes inside of freed 2048-byte region [ffff88806fc55000, ffff88806fc55800) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x6fc50 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 memcg:ffff88804cd7a881 anon flags: 0x4fff00000000040(head|node=1|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 04fff00000000040 ffff88801b44c140 0000000000000000 dead000000000001 raw: 0000000000000000 0000000000080008 00000000f5000000 ffff88804cd7a881 head: 04fff00000000040 ffff88801b44c140 0000000000000000 dead000000000001 head: 0000000000000000 0000000000080008 00000000f5000000 ffff88804cd7a881 head: 04fff00000000003 ffffea0001bf1401 00000000ffffffff 00000000ffffffff head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000008 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 5947, tgid 5947 (syz-executor), ts 201168156780, free_ts 201159831430 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1af/0x220 mm/page_alloc.c:1846 prep_new_page mm/page_alloc.c:1854 [inline] get_page_from_freelist+0xd0b/0x31a0 mm/page_alloc.c:3915 __alloc_frozen_pages_noprof+0x25f/0x2430 mm/page_alloc.c:5210 alloc_pages_mpol+0x1fb/0x550 mm/mempolicy.c:2486 alloc_slab_page mm/slub.c:3075 [inline] allocate_slab mm/slub.c:3248 [inline] new_slab+0x2c3/0x430 mm/slub.c:3302 ___slab_alloc+0xe18/0x1c90 mm/slub.c:4656 __slab_alloc.constprop.0+0x63/0x110 mm/slub.c:4779 __slab_alloc_node mm/slub.c:4855 [inline] slab_alloc_node mm/slub.c:5251 [inline] __do_kmalloc_node mm/slub.c:5656 [inline] __kvmalloc_node_noprof+0x592/0xa40 mm/slub.c:7134 xt_alloc_table_info+0x43/0xa0 net/netfilter/x_tables.c:1193 compat_do_replace+0x1ea/0x520 net/ipv6/netfilter/ip6_tables.c:1523 do_ip6t_set_ctl+0x5ed/0xbc0 net/ipv6/netfilter/ip6_tables.c:1641 nf_setsockopt+0x8d/0xf0 net/netfilter/nf_sockopt.c:101 ipv6_setsockopt+0x135/0x170 net/ipv6/ipv6_sockglue.c:978 tcp_setsockopt+0xa7/0x100 net/ipv4/tcp.c:4166 do_sock_setsockopt+0xf3/0x1d0 net/socket.c:2322 __sys_setsockopt+0x120/0x1a0 net/socket.c:2347 page last free pid 5921 tgid 5921 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1395 [inline] __free_frozen_pages+0x7df/0x1170 mm/page_alloc.c:2943 __folio_put+0x329/0x450 mm/swap.c:112 folio_put include/linux/mm.h:1612 [inline] put_page include/linux/mm.h:1681 [inline] put_netmem net/core/skbuff.c:7417 [inline] skb_page_unref include/linux/skbuff_ref.h:43 [inline] __skb_frag_unref include/linux/skbuff_ref.h:56 [inline] skb_release_data+0x81a/0x9e0 net/core/skbuff.c:1101 skb_release_all net/core/skbuff.c:1182 [inline] __kfree_skb net/core/skbuff.c:1196 [inline] kfree_skb_napi_cache net/core/skbuff.c:7210 [inline] skb_attempt_defer_free+0x52f/0x710 net/core/skbuff.c:7238 tcp_eat_recv_skb net/ipv4/tcp.c:1583 [inline] tcp_recvmsg_locked+0x11e3/0x2910 net/ipv4/tcp.c:2883 tcp_recvmsg+0x12f/0x680 net/ipv4/tcp.c:2929 inet_recvmsg+0x129/0x6a0 net/ipv4/af_inet.c:891 sock_recvmsg_nosec net/socket.c:1078 [inline] sock_recvmsg+0x1b2/0x250 net/socket.c:1100 sock_read_iter+0x2b9/0x3b0 net/socket.c:1170 new_sync_read fs/read_write.c:491 [inline] vfs_read+0xa98/0xcf0 fs/read_write.c:572 ksys_read+0x1f8/0x250 fs/read_write.c:715 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xcd/0xf80 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff88806fc55380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88806fc55400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88806fc55480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88806fc55500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88806fc55580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================