Hay
Date
June 24, 2025, 11:37 a.m.

Environment
qemu-x86_64

[  196.083372] ==================================================================
[  196.083918] BUG: KASAN: slab-use-after-free in drm_encoder_cleanup+0x265/0x270
[  196.084594] Read of size 8 at addr ffff8881044e3070 by task kunit_try_catch/1679
[  196.085105] 
[  196.085298] CPU: 1 UID: 0 PID: 1679 Comm: kunit_try_catch Tainted: G    B D W        N  6.16.0-rc3-next-20250624 #1 PREEMPT(voluntary) 
[  196.085470] Tainted: [B]=BAD_PAGE, [D]=DIE, [W]=WARN, [N]=TEST
[  196.085500] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[  196.085533] Call Trace:
[  196.085561]  <TASK>
[  196.085598]  dump_stack_lvl+0x73/0xb0
[  196.085670]  print_report+0xd1/0x650
[  196.085727]  ? __virt_addr_valid+0x1db/0x2d0
[  196.085795]  ? drm_encoder_cleanup+0x265/0x270
[  196.085860]  ? kasan_complete_mode_report_info+0x64/0x200
[  196.085930]  ? drm_encoder_cleanup+0x265/0x270
[  196.085992]  kasan_report+0x141/0x180
[  196.086052]  ? drm_encoder_cleanup+0x265/0x270
[  196.086153]  __asan_report_load8_noabort+0x18/0x20
[  196.086213]  drm_encoder_cleanup+0x265/0x270
[  196.086270]  drmm_encoder_alloc_release+0x36/0x60
[  196.086320]  drm_managed_release+0x15c/0x470
[  196.086367]  ? simple_release_fs+0x86/0xb0
[  196.086442]  drm_dev_put.part.0+0xa1/0x100
[  196.086492]  ? __pfx_devm_drm_dev_init_release+0x10/0x10
[  196.086544]  devm_drm_dev_init_release+0x17/0x30
[  196.086591]  devm_action_release+0x50/0x80
[  196.086650]  devres_release_all+0x186/0x240
[  196.086703]  ? __pfx_devres_release_all+0x10/0x10
[  196.086756]  ? kernfs_remove_by_name_ns+0x166/0x1d0
[  196.086816]  ? sysfs_remove_file_ns+0x56/0xa0
[  196.086870]  device_unbind_cleanup+0x1b/0x1b0
[  196.086925]  device_release_driver_internal+0x3e4/0x540
[  196.086974]  ? klist_devices_put+0x35/0x50
[  196.087027]  device_release_driver+0x16/0x20
[  196.087080]  bus_remove_device+0x1e9/0x3d0
[  196.087137]  device_del+0x397/0x980
[  196.087205]  ? __pfx_device_del+0x10/0x10
[  196.087267]  ? __kasan_check_write+0x18/0x20
[  196.087307]  ? _raw_spin_lock_irqsave+0xa1/0x100
[  196.087344]  ? __pfx_device_unregister_wrapper+0x10/0x10
[  196.087379]  device_unregister+0x1b/0xa0
[  196.087409]  device_unregister_wrapper+0x12/0x20
[  196.087459]  __kunit_action_free+0x57/0x70
[  196.087492]  kunit_remove_resource+0x133/0x200
[  196.087550]  ? preempt_count_sub+0x50/0x80
[  196.087588]  kunit_cleanup+0x7a/0x120
[  196.087621]  kunit_try_run_case_cleanup+0xbd/0xf0
[  196.087653]  ? __pfx_kunit_try_run_case_cleanup+0x10/0x10
[  196.087682]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[  196.087723]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[  196.087752]  kthread+0x337/0x6f0
[  196.087780]  ? trace_preempt_on+0x20/0xc0
[  196.087812]  ? __pfx_kthread+0x10/0x10
[  196.087839]  ? _raw_spin_unlock_irq+0x47/0x80
[  196.087869]  ? calculate_sigpending+0x7b/0xa0
[  196.087900]  ? __pfx_kthread+0x10/0x10
[  196.087927]  ret_from_fork+0x116/0x1d0
[  196.087955]  ? __pfx_kthread+0x10/0x10
[  196.087982]  ret_from_fork_asm+0x1a/0x30
[  196.088021]  </TASK>
[  196.088038] 
[  196.106624] Allocated by task 1678:
[  196.107075]  kasan_save_stack+0x45/0x70
[  196.107421]  kasan_save_track+0x18/0x40
[  196.107900]  kasan_save_alloc_info+0x3b/0x50
[  196.108194]  __kasan_kmalloc+0xb7/0xc0
[  196.108638]  __kmalloc_noprof+0x1c9/0x500
[  196.108962]  __devm_drm_bridge_alloc+0x33/0x170
[  196.109455]  drm_test_bridge_init+0x188/0x5c0
[  196.109954]  drm_test_drm_bridge_get_current_state_atomic+0xea/0x870
[  196.110374]  kunit_try_run_case+0x1a5/0x480
[  196.110698]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[  196.111092]  kthread+0x337/0x6f0
[  196.111477]  ret_from_fork+0x116/0x1d0
[  196.111914]  ret_from_fork_asm+0x1a/0x30
[  196.112321] 
[  196.112595] Freed by task 1679:
[  196.112937]  kasan_save_stack+0x45/0x70
[  196.113367]  kasan_save_track+0x18/0x40
[  196.113838]  kasan_save_free_info+0x3f/0x60
[  196.114255]  __kasan_slab_free+0x56/0x70
[  196.114642]  kfree+0x222/0x3f0
[  196.114987]  drm_bridge_put.part.0+0xc7/0x100
[  196.115377]  drm_bridge_put_void+0x17/0x30
[  196.115694]  devm_action_release+0x50/0x80
[  196.116075]  devres_release_all+0x186/0x240
[  196.116583]  device_unbind_cleanup+0x1b/0x1b0
[  196.117035]  device_release_driver_internal+0x3e4/0x540
[  196.117635]  device_release_driver+0x16/0x20
[  196.117980]  bus_remove_device+0x1e9/0x3d0
[  196.118401]  device_del+0x397/0x980
[  196.118876]  device_unregister+0x1b/0xa0
[  196.119133]  device_unregister_wrapper+0x12/0x20
[  196.119400]  __kunit_action_free+0x57/0x70
[  196.119884]  kunit_remove_resource+0x133/0x200
[  196.120489]  kunit_cleanup+0x7a/0x120
[  196.121011]  kunit_try_run_case_cleanup+0xbd/0xf0
[  196.121573]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[  196.122041]  kthread+0x337/0x6f0
[  196.122424]  ret_from_fork+0x116/0x1d0
[  196.122834]  ret_from_fork_asm+0x1a/0x30
[  196.123239] 
[  196.123417] The buggy address belongs to the object at ffff8881044e3000
[  196.123417]  which belongs to the cache kmalloc-512 of size 512
[  196.124008] The buggy address is located 112 bytes inside of
[  196.124008]  freed 512-byte region [ffff8881044e3000, ffff8881044e3200)
[  196.124685] 
[  196.124905] The buggy address belongs to the physical page:
[  196.125415] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1044e0
[  196.126169] head: order:2 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
[  196.126923] flags: 0x200000000000040(head|node=0|zone=2)
[  196.127452] page_type: f5(slab)
[  196.127846] raw: 0200000000000040 ffff888100041c80 dead000000000122 0000000000000000
[  196.128491] raw: 0000000000000000 0000000080100010 00000000f5000000 0000000000000000
[  196.128894] head: 0200000000000040 ffff888100041c80 dead000000000122 0000000000000000
[  196.129250] head: 0000000000000000 0000000080100010 00000000f5000000 0000000000000000
[  196.129831] head: 0200000000000002 ffffea0004113801 00000000ffffffff 00000000ffffffff
[  196.130554] head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000004
[  196.131248] page dumped because: kasan: bad access detected
[  196.131791] 
[  196.132059] Memory state around the buggy address:
[  196.132544]  ffff8881044e2f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[  196.133219]  ffff8881044e2f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[  196.133822] >ffff8881044e3000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[  196.134161]                                                              ^
[  196.134922]  ffff8881044e3080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[  196.135590]  ffff8881044e3100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[  196.136263] ==================================================================