Hay
Date
June 17, 2025, 6:35 a.m.

Environment
qemu-x86_64

[  205.261688] ==================================================================
[  205.262215] BUG: KASAN: slab-use-after-free in drm_encoder_cleanup+0x265/0x270
[  205.262846] Read of size 8 at addr ffff88810583c070 by task kunit_try_catch/1606
[  205.263410] 
[  205.263639] CPU: 1 UID: 0 PID: 1606 Comm: kunit_try_catch Tainted: G    B D W        N  6.16.0-rc2-next-20250617 #1 PREEMPT(voluntary) 
[  205.263817] Tainted: [B]=BAD_PAGE, [D]=DIE, [W]=WARN, [N]=TEST
[  205.263858] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
[  205.263915] Call Trace:
[  205.263952]  <TASK>
[  205.264000]  dump_stack_lvl+0x73/0xb0
[  205.264082]  print_report+0xd1/0x650
[  205.264160]  ? __virt_addr_valid+0x1db/0x2d0
[  205.264253]  ? drm_encoder_cleanup+0x265/0x270
[  205.264321]  ? kasan_complete_mode_report_info+0x64/0x200
[  205.264388]  ? drm_encoder_cleanup+0x265/0x270
[  205.264455]  kasan_report+0x141/0x180
[  205.264510]  ? drm_encoder_cleanup+0x265/0x270
[  205.264568]  __asan_report_load8_noabort+0x18/0x20
[  205.264626]  drm_encoder_cleanup+0x265/0x270
[  205.264699]  drmm_encoder_alloc_release+0x36/0x60
[  205.264770]  drm_managed_release+0x15c/0x470
[  205.264864]  ? simple_release_fs+0x86/0xb0
[  205.264945]  drm_dev_put.part.0+0xa1/0x100
[  205.265016]  ? __pfx_devm_drm_dev_init_release+0x10/0x10
[  205.265094]  devm_drm_dev_init_release+0x17/0x30
[  205.265168]  devm_action_release+0x50/0x80
[  205.265245]  devres_release_all+0x186/0x240
[  205.265319]  ? __pfx_devres_release_all+0x10/0x10
[  205.265386]  ? kernfs_remove_by_name_ns+0x166/0x1d0
[  205.265430]  ? sysfs_remove_file_ns+0x56/0xa0
[  205.265466]  device_unbind_cleanup+0x1b/0x1b0
[  205.265498]  device_release_driver_internal+0x3e4/0x540
[  205.265530]  ? klist_devices_put+0x35/0x50
[  205.265566]  device_release_driver+0x16/0x20
[  205.265597]  bus_remove_device+0x1e9/0x3d0
[  205.265627]  device_del+0x397/0x980
[  205.265659]  ? __pfx_device_del+0x10/0x10
[  205.265687]  ? __kasan_check_write+0x18/0x20
[  205.265713]  ? _raw_spin_lock_irqsave+0xa1/0x100
[  205.265742]  ? __pfx_device_unregister_wrapper+0x10/0x10
[  205.265776]  device_unregister+0x1b/0xa0
[  205.265832]  device_unregister_wrapper+0x12/0x20
[  205.265866]  __kunit_action_free+0x57/0x70
[  205.265899]  kunit_remove_resource+0x133/0x200
[  205.265930]  ? preempt_count_sub+0x50/0x80
[  205.265963]  kunit_cleanup+0x7a/0x120
[  205.265999]  kunit_try_run_case_cleanup+0xbd/0xf0
[  205.266030]  ? __pfx_kunit_try_run_case_cleanup+0x10/0x10
[  205.266064]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[  205.266093]  ? __pfx_kunit_generic_run_threadfn_adapter+0x10/0x10
[  205.266121]  kthread+0x337/0x6f0
[  205.266151]  ? trace_preempt_on+0x20/0xc0
[  205.266191]  ? __pfx_kthread+0x10/0x10
[  205.266243]  ? _raw_spin_unlock_irq+0x47/0x80
[  205.266280]  ? calculate_sigpending+0x7b/0xa0
[  205.266315]  ? __pfx_kthread+0x10/0x10
[  205.266345]  ret_from_fork+0x116/0x1d0
[  205.266373]  ? __pfx_kthread+0x10/0x10
[  205.266402]  ret_from_fork_asm+0x1a/0x30
[  205.266444]  </TASK>
[  205.266462] 
[  205.289380] Allocated by task 1605:
[  205.289739]  kasan_save_stack+0x45/0x70
[  205.290167]  kasan_save_track+0x18/0x40
[  205.290504]  kasan_save_alloc_info+0x3b/0x50
[  205.290835]  __kasan_kmalloc+0xb7/0xc0
[  205.291251]  __kmalloc_noprof+0x1c9/0x500
[  205.291660]  __devm_drm_bridge_alloc+0x33/0x170
[  205.292062]  drm_test_bridge_init+0x188/0x5c0
[  205.292483]  drm_test_drm_bridge_get_current_state_atomic+0xea/0x870
[  205.292893]  kunit_try_run_case+0x1a5/0x480
[  205.293330]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[  205.293822]  kthread+0x337/0x6f0
[  205.294169]  ret_from_fork+0x116/0x1d0
[  205.294629]  ret_from_fork_asm+0x1a/0x30
[  205.294958] 
[  205.295118] Freed by task 1606:
[  205.295401]  kasan_save_stack+0x45/0x70
[  205.295694]  kasan_save_track+0x18/0x40
[  205.296115]  kasan_save_free_info+0x3f/0x60
[  205.296592]  __kasan_slab_free+0x56/0x70
[  205.296997]  kfree+0x222/0x3f0
[  205.297408]  drm_bridge_put.part.0+0xc7/0x100
[  205.297834]  drm_bridge_put_void+0x17/0x30
[  205.298256]  devm_action_release+0x50/0x80
[  205.298549]  devres_release_all+0x186/0x240
[  205.298863]  device_unbind_cleanup+0x1b/0x1b0
[  205.299274]  device_release_driver_internal+0x3e4/0x540
[  205.299767]  device_release_driver+0x16/0x20
[  205.300249]  bus_remove_device+0x1e9/0x3d0
[  205.300646]  device_del+0x397/0x980
[  205.301043]  device_unregister+0x1b/0xa0
[  205.301480]  device_unregister_wrapper+0x12/0x20
[  205.301962]  __kunit_action_free+0x57/0x70
[  205.302338]  kunit_remove_resource+0x133/0x200
[  205.302760]  kunit_cleanup+0x7a/0x120
[  205.303150]  kunit_try_run_case_cleanup+0xbd/0xf0
[  205.303592]  kunit_generic_run_threadfn_adapter+0x85/0xf0
[  205.304010]  kthread+0x337/0x6f0
[  205.304328]  ret_from_fork+0x116/0x1d0
[  205.304611]  ret_from_fork_asm+0x1a/0x30
[  205.304981] 
[  205.305224] The buggy address belongs to the object at ffff88810583c000
[  205.305224]  which belongs to the cache kmalloc-512 of size 512
[  205.306308] The buggy address is located 112 bytes inside of
[  205.306308]  freed 512-byte region [ffff88810583c000, ffff88810583c200)
[  205.307039] 
[  205.307247] The buggy address belongs to the physical page:
[  205.307722] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10583c
[  205.308434] head: order:2 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
[  205.309100] anon flags: 0x200000000000040(head|node=0|zone=2)
[  205.309623] page_type: f5(slab)
[  205.309951] raw: 0200000000000040 ffff888100041c80 0000000000000000 0000000000000001
[  205.310552] raw: 0000000000000000 0000000000100010 00000000f5000000 0000000000000000
[  205.311139] head: 0200000000000040 ffff888100041c80 0000000000000000 0000000000000001
[  205.311706] head: 0000000000000000 0000000000100010 00000000f5000000 0000000000000000
[  205.312254] head: 0200000000000002 ffffea0004160f01 00000000ffffffff 00000000ffffffff
[  205.312853] head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000004
[  205.315054] page dumped because: kasan: bad access detected
[  205.315601] 
[  205.315827] Memory state around the buggy address:
[  205.316885]  ffff88810583bf00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[  205.317547]  ffff88810583bf80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
[  205.318173] >ffff88810583c000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[  205.318734]                                                              ^
[  205.319173]  ffff88810583c080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[  205.319705]  ffff88810583c100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[  205.320339] ==================================================================