Hay
Date
June 16, 2025, 7:07 a.m.

Environment
qemu-x86_64

[  147.182704] ==================================================================
[  147.183061] BUG: KASAN: slab-use-after-free in drm_encoder_cleanup+0x265/0x270
[  147.183338] Read of size 8 at addr ffff8881060ba870 by task kunit_try_catch/1605
[  147.184213] 
[  147.184583] CPU: 0 UID: 0 PID: 1605 Comm: kunit_try_catch Tainted: G    B D W        N  6.16.0-rc2-next-20250616 #1 PREEMPT(voluntary) 
[  147.184639] Tainted: [B]=BAD_PAGE, [D]=DIE, [W]=WARN, [N]=TEST
[  147.184652] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[  147.184670] Call Trace:
[  147.184683]  <TASK>
[  147.184706]  dump_stack_lvl+0x73/0xb0
[  147.184741]  print_report+0xd1/0x650
[  147.184768]  ? __virt_addr_valid+0x1db/0x2d0
[  147.184793]  ? drm_encoder_cleanup+0x265/0x270
[  147.184815]  ? kasan_complete_mode_report_info+0x64/0x200
[  147.184850]  ? drm_encoder_cleanup+0x265/0x270
[  147.184873]  kasan_report+0x141/0x180
[  147.184894]  ? drm_encoder_cleanup+0x265/0x270
[  147.184920]  __asan_report_load8_noabort+0x18/0x20
[  147.184943]  drm_encoder_cleanup+0x265/0x270
[  147.184967]  drmm_encoder_alloc_release+0x36/0x60
[  147.184989]  drm_managed_release+0x15c/0x470
[  147.185011]  ? simple_release_fs+0x86/0xb0
[  147.185038]  drm_dev_put.part.0+0xa1/0x100
[  147.185060]  ? __pfx_devm_drm_dev_init_release+0x10/0x10
[  147.185083]  devm_drm_dev_init_release+0x17/0x30
[  147.185107]  devm_action_release+0x50/0x80
[  147.185132]  devres_release_all+0x186/0x240
[  147.185154]  ? __pfx_devres_release_all+0x10/0x10
[  147.185175]  ? kernfs_remove_by_name_ns+0x166/0x1d0
[  147.185201]  ? sysfs_remove_file_ns+0x56/0xa0
[  147.185226]  device_unbind_cleanup+0x1b/0x1b0
[  147.185247]  device_release_driver_internal+0x3e4/0x540
[  147.185268]  ? klist_devices_put+0x35/0x50
[  147.185322]  device_release_driver+0x16/0x20
[  147.185343]  bus_remove_device+0x1e9/0x3d0
[  147.185364]  device_del+0x397/0x980
[  147.185387]  ? __pfx_device_del+0x10/0x10
[  147.185407]  ? __kasan_check_write+0x18/0x20
[  147.185425]  ? _raw_spin_lock_irqsave+0xa1/0x100
[  147.185448]  ? __pfx_device_unregister_wrapper+0x10/0x10
[  147.185473]  device_unregister+0x1b/0xa0
[  147.185493]  device_unregister_wrapper+0x12/0x20
[  147.185513]  __kunit_action_free+0x57/0x70
[  147.185535]  kunit_remove_resource+0x133/0x200
[  147.185555]  ? preempt_count_sub+0x50/0x80
[  147.185579]  kunit_cleanup+0x7a/0x120
[  147.185610]  kunit_try_run_case_cleanup+0xbd/0xf0
[  147.185634]  ? __pfx_kunit_try_run_case_cleanup+0x10/0x10
[  147.185655]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[  147.185675]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[  147.185695]  kthread+0x337/0x6f0
[  147.185716]  ? trace_preempt_on+0x20/0xc0
[  147.185740]  ? __pfx_kthread+0x10/0x10
[  147.185761]  ? _raw_spin_unlock_irq+0x47/0x80
[  147.185780]  ? calculate_sigpending+0x7b/0xa0
[  147.185805]  ? __pfx_kthread+0x10/0x10
[  147.185826]  ret_from_fork+0x116/0x1d0
[  147.185857]  ? __pfx_kthread+0x10/0x10
[  147.185877]  ret_from_fork_asm+0x1a/0x30
[  147.185907]  </TASK>
[  147.185920] 
[  147.196284] Allocated by task 1604:
[  147.196486]  kasan_save_stack+0x45/0x70
[  147.196699]  kasan_save_track+0x18/0x40
[  147.196898]  kasan_save_alloc_info+0x3b/0x50
[  147.197131]  __kasan_kmalloc+0xb7/0xc0
[  147.197347]  __kmalloc_noprof+0x1c9/0x500
[  147.197561]  __devm_drm_bridge_alloc+0x33/0x170
[  147.197782]  drm_test_bridge_init+0x188/0x5c0
[  147.197993]  drm_test_drm_bridge_get_current_state_atomic+0xea/0x870
[  147.198190]  kunit_try_run_case+0x1a5/0x480
[  147.198360]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[  147.198610]  kthread+0x337/0x6f0
[  147.198787]  ret_from_fork+0x116/0x1d0
[  147.199013]  ret_from_fork_asm+0x1a/0x30
[  147.199238] 
[  147.199857] Freed by task 1605:
[  147.200037]  kasan_save_stack+0x45/0x70
[  147.200184]  kasan_save_track+0x18/0x40
[  147.200497]  kasan_save_free_info+0x3f/0x60
[  147.200719]  __kasan_slab_free+0x56/0x70
[  147.200918]  kfree+0x222/0x3f0
[  147.201983]  drm_bridge_put.part.0+0xc7/0x100
[  147.202171]  drm_bridge_put_void+0x17/0x30
[  147.202751]  devm_action_release+0x50/0x80
[  147.203276]  devres_release_all+0x186/0x240
[  147.203863]  device_unbind_cleanup+0x1b/0x1b0
[  147.204460]  device_release_driver_internal+0x3e4/0x540
[  147.205005]  device_release_driver+0x16/0x20
[  147.205165]  bus_remove_device+0x1e9/0x3d0
[  147.205308]  device_del+0x397/0x980
[  147.205548]  device_unregister+0x1b/0xa0
[  147.205933]  device_unregister_wrapper+0x12/0x20
[  147.206427]  __kunit_action_free+0x57/0x70
[  147.206819]  kunit_remove_resource+0x133/0x200
[  147.207233]  kunit_cleanup+0x7a/0x120
[  147.207652]  kunit_try_run_case_cleanup+0xbd/0xf0
[  147.207810]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[  147.207991]  kthread+0x337/0x6f0
[  147.208114]  ret_from_fork+0x116/0x1d0
[  147.208245]  ret_from_fork_asm+0x1a/0x30
[  147.208497] 
[  147.208598] The buggy address belongs to the object at ffff8881060ba800
[  147.208598]  which belongs to the cache kmalloc-512 of size 512
[  147.209560] The buggy address is located 112 bytes inside of
[  147.209560]  freed 512-byte region [ffff8881060ba800, ffff8881060baa00)
[  147.209930] 
[  147.210004] The buggy address belongs to the physical page:
[  147.210181] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1060b8
[  147.210443] head: order:2 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
[  147.210866] flags: 0x200000000000040(head|node=0|zone=2)
[  147.211103] page_type: f5(slab)
[  147.211231] raw: 0200000000000040 ffff888100041c80 dead000000000122 0000000000000000
[  147.211793] raw: 0000000000000000 0000000080100010 00000000f5000000 0000000000000000
[  147.212159] head: 0200000000000040 ffff888100041c80 dead000000000122 0000000000000000
[  147.212566] head: 0000000000000000 0000000080100010 00000000f5000000 0000000000000000
[  147.212928] head: 0200000000000002 ffffea0004182e01 00000000ffffffff 00000000ffffffff
[  147.213265] head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000004
[  147.213585] page dumped because: kasan: bad access detected
[  147.213846] 
[  147.213931] Memory state around the buggy address:
[  147.214085]  ffff8881060ba700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[  147.214397]  ffff8881060ba780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[  147.214615] >ffff8881060ba800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[  147.215185]                                                              ^
[  147.215588]  ffff8881060ba880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[  147.215917]  ffff8881060ba900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[  147.216197] ==================================================================