================================================================== BUG: KASAN: slab-use-after-free in drm_atomic_helper_wait_for_vblanks.part.0+0x7d0/0x890 drivers/gpu/drm/drm_atomic_helper.c:1905 Read of size 1 at addr ffff888061cca009 by task kworker/u33:14/1179 CPU: 1 UID: 0 PID: 1179 Comm: kworker/u33:14 Tainted: G L syzkaller #0 PREEMPT(full) Tainted: [L]=SOFTLOCKUP Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 Workqueue: events_unbound commit_work Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x100/0x190 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0x13d/0x4b0 mm/kasan/report.c:482 kasan_report+0xdf/0x1c0 mm/kasan/report.c:595 drm_atomic_helper_wait_for_vblanks.part.0+0x7d0/0x890 drivers/gpu/drm/drm_atomic_helper.c:1905 drm_atomic_helper_wait_for_vblanks drivers/gpu/drm/drm_atomic_helper.c:1901 [inline] drm_atomic_helper_commit_tail+0xff/0x130 drivers/gpu/drm/drm_atomic_helper.c:2003 commit_tail.isra.0+0x33e/0x420 drivers/gpu/drm/drm_atomic_helper.c:2080 process_one_work+0xac7/0x1b10 kernel/workqueue.c:3495 process_scheduled_works kernel/workqueue.c:3578 [inline] worker_thread+0x5ef/0xe50 kernel/workqueue.c:3659 kthread+0x373/0x450 kernel/kthread.c:436 ret_from_fork+0x730/0xd60 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Allocated by task 6760: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x30 mm/kasan/common.c:78 poison_kmalloc_redzone mm/kasan/common.c:409 [inline] __kasan_kmalloc+0xaa/0xb0 mm/kasan/common.c:426 kasan_kmalloc include/linux/kasan.h:263 [inline] __kmalloc_cache_noprof+0x2f8/0x6d0 mm/slub.c:5680 _kmalloc_noprof include/linux/slab.h:991 [inline] drm_atomic_helper_crtc_duplicate_state+0x72/0xd0 drivers/gpu/drm/drm_atomic_state_helper.c:159 drm_atomic_get_crtc_state+0x1de/0x690 drivers/gpu/drm/drm_atomic.c:472 page_flip_common+0x59/0x320 drivers/gpu/drm/drm_atomic_helper.c:3947 drm_atomic_helper_page_flip+0xb6/0x180 drivers/gpu/drm/drm_atomic_helper.c:4008 drm_mode_page_flip_ioctl+0x1095/0x14a0 drivers/gpu/drm/drm_plane.c:1543 drm_ioctl_kernel+0x1f3/0x3e0 drivers/gpu/drm/drm_ioctl.c:817 drm_ioctl+0x5e6/0xc60 drivers/gpu/drm/drm_ioctl.c:914 drm_compat_ioctl+0x386/0x4c0 drivers/gpu/drm/drm_ioc32.c:381 __do_compat_sys_ioctl fs/ioctl.c:695 [inline] __se_compat_sys_ioctl fs/ioctl.c:638 [inline] __ia32_compat_sys_ioctl+0x2cf/0x360 fs/ioctl.c:638 do_syscall_32_irqs_on arch/x86/entry/syscall_32.c:79 [inline] __do_fast_syscall_32+0x14b/0x8c0 arch/x86/entry/syscall_32.c:282 do_fast_syscall_32+0x32/0x70 arch/x86/entry/syscall_32.c:307 entry_SYSENTER_compat_after_hwframe+0x84/0x8e Freed by task 855: kasan_save_stack+0x30/0x50 mm/kasan/common.c:57 kasan_save_track+0x14/0x30 mm/kasan/common.c:78 kasan_save_free_info+0x3b/0x70 mm/kasan/generic.c:584 poison_slab_object mm/kasan/common.c:264 [inline] __kasan_slab_free+0x5f/0x80 mm/kasan/common.c:296 kasan_slab_free include/linux/kasan.h:235 [inline] slab_free_hook mm/slub.c:2780 [inline] slab_free mm/slub.c:6630 [inline] kfree+0x22b/0x6d0 mm/slub.c:6923 drm_atomic_commit_default_clear+0x4aa/0x1140 drivers/gpu/drm/drm_atomic.c:314 drm_atomic_commit_clear drivers/gpu/drm/drm_atomic.c:404 [inline] __drm_atomic_commit_free+0x185/0x2f0 drivers/gpu/drm/drm_atomic.c:421 kref_put include/linux/kref.h:65 [inline] drm_atomic_commit_put include/drm/drm_atomic.h:729 [inline] drm_atomic_helper_dirtyfb+0x578/0x790 drivers/gpu/drm/drm_damage_helper.c:195 drm_fbdev_shmem_helper_fb_dirty+0x1cc/0x350 drivers/gpu/drm/drm_fbdev_shmem.c:117 drm_fb_helper_fb_dirty drivers/gpu/drm/clients/drm_fbdev_helper.c:310 [inline] drm_fb_helper_damage_work+0x4c8/0xab0 drivers/gpu/drm/clients/drm_fbdev_helper.c:336 process_one_work+0xac7/0x1b10 kernel/workqueue.c:3495 process_scheduled_works kernel/workqueue.c:3578 [inline] worker_thread+0x5ef/0xe50 kernel/workqueue.c:3659 kthread+0x373/0x450 kernel/kthread.c:436 ret_from_fork+0x730/0xd60 arch/x86/kernel/process.c:158 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 The buggy address belongs to the object at ffff888061cca000 which belongs to the cache kmalloc-512 of size 512 The buggy address is located 9 bytes inside of freed 512-byte region [ffff888061cca000, ffff888061cca200) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xffff888061cc8000 pfn:0x61cc8 head: order:2 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0x4fff00000000240(workingset|head|node=1|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 04fff00000000240 ffff88801d442c80 ffffea0001875610 ffffea000149c310 raw: ffff888061cc8000 0000000000100009 00000000f5000000 0000000000000000 head: 04fff00000000240 ffff88801d442c80 ffffea0001875610 ffffea000149c310 head: ffff888061cc8000 0000000000100009 00000000f5000000 0000000000000000 head: 04fff00000000002 ffffffffffffff01 00000000ffffffff 00000000ffffffff head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000004 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 2, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 6305, tgid 6304 (syz.3.74), ts 91165374767 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0xfd/0x120 mm/page_alloc.c:1854 prep_new_page mm/page_alloc.c:1862 [inline] get_page_from_freelist+0x1113/0x35e0 mm/page_alloc.c:3933 __alloc_frozen_pages_noprof+0x2f6/0x3190 mm/page_alloc.c:5429 alloc_slab_page mm/slub.c:3384 [inline] allocate_slab mm/slub.c:3499 [inline] new_slab+0xb1/0x6d0 mm/slub.c:3550 refill_objects+0xe3/0x410 mm/slub.c:7539 refill_sheaf mm/slub.c:2917 [inline] __pcs_replace_empty_main+0x35e/0x650 mm/slub.c:4811 alloc_from_pcs mm/slub.c:4887 [inline] slab_alloc_node mm/slub.c:5021 [inline] __kmalloc_cache_noprof+0x4ef/0x6d0 mm/slub.c:5676 _kmalloc_noprof include/linux/slab.h:991 [inline] _kzalloc_noprof include/linux/slab.h:1312 [inline] genradix_alloc_node include/linux/generic-radix-tree.h:101 [inline] __genradix_ptr_alloc+0x4e3/0x610 lib/generic-radix-tree.c:69 __genradix_prealloc+0x5c/0x90 lib/generic-radix-tree.c:216 sctp_stream_alloc_out net/sctp/stream.c:113 [inline] sctp_stream_init+0x28a/0x420 net/sctp/stream.c:158 sctp_association_init net/sctp/associola.c:232 [inline] sctp_association_new+0x153c/0x2990 net/sctp/associola.c:296 sctp_connect_new_asoc+0x1a8/0x770 net/sctp/socket.c:1130 sctp_sendmsg_new_asoc net/sctp/socket.c:1730 [inline] sctp_sendmsg+0x1743/0x22e0 net/sctp/socket.c:2059 inet_sendmsg+0x11c/0x140 net/ipv4/af_inet.c:864 sock_sendmsg_nosec net/socket.c:800 [inline] __sock_sendmsg net/socket.c:818 [inline] ____sys_sendmsg+0xa23/0xc30 net/socket.c:2715 ___sys_sendmsg+0x190/0x1e0 net/socket.c:2769 page last free pid 5804 tgid 5804 ts 68090517801 stack trace: reset_page_owner include/linux/page_owner.h:26 [inline] __free_pages_prepare mm/page_alloc.c:1401 [inline] __free_frozen_pages+0x7b4/0x1110 mm/page_alloc.c:2952 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x47/0xf0 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x1a0/0x1f0 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x69/0x90 mm/kasan/common.c:361 kasan_slab_alloc include/linux/kasan.h:253 [inline] slab_post_alloc_hook mm/slub.c:4720 [inline] slab_alloc_node mm/slub.c:5033 [inline] __do_kmalloc_node mm/slub.c:5530 [inline] __kmalloc_node_track_caller_noprof+0x2da/0x870 mm/slub.c:5662 __kmemdup_nul mm/util.c:64 [inline] kstrdup+0x51/0xe0 mm/util.c:84 kstrdup_const+0x63/0x80 mm/util.c:104 __kernfs_new_node+0x9b/0xa10 fs/kernfs/dir.c:663 kernfs_new_node+0x194/0x200 fs/kernfs/dir.c:759 __kernfs_create_file+0x53/0x350 fs/kernfs/file.c:1071 sysfs_add_file_mode_ns+0x207/0x3c0 fs/sysfs/file.c:316 create_files fs/sysfs/group.c:82 [inline] internal_create_group+0x593/0xfb0 fs/sysfs/group.c:189 internal_create_groups+0x9d/0x150 fs/sysfs/group.c:229 setup_port+0x409/0x16c0 drivers/infiniband/core/sysfs.c:1207 ib_setup_port_attrs+0x201/0x600 drivers/infiniband/core/sysfs.c:1393 add_one_compat_dev+0x5ae/0x820 drivers/infiniband/core/device.c:1002 Memory state around the buggy address: ffff888061cc9f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888061cc9f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888061cca000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888061cca080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888061cca100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================