summaryrefslogtreecommitdiff
path: root/rust/kernel/alloc/allocator
diff options
context:
space:
mode:
authorMaíra Canal <mcanal@igalia.com>2026-11-14 16:16:50 -0300
committerMaíra Canal <mcanal@igalia.com>2026-11-17 17:13:30 -0300
commit43b85636ea0d33152bf16816b7601e785723596d (patch)
treeb37b8f3f2ac13a975442df0415d391c586eb7abf /rust/kernel/alloc/allocator
parent9bca2b5f1a4fa93ed628d47e66d1d8df86937131 (diff)
drm/vc4: Drop BO usecnt before releasing the old FB
The async page flip completion drops the old FB reference before decrementing its BO usecnt. If that was the last reference, the BO is already freed or recycled into the BO cache when vc4_bo_dec_usecnt() runs, leading to a use-after-free or a refcount underflow. For example, while running glmark2-es2-drm in the Raspberry Pi 3, the following warning appears: [ 459.078834] ------------[ cut here ]------------ [ 459.078855] refcount_t: underflow; use-after-free. [ 459.078952] WARNING: lib/refcount.c:96 at refcount_dec_not_one+0xa0/0xa8, CPU#0: swapper/0/0 <snip> [ 459.079316] Call trace: [ 459.079323] refcount_dec_not_one+0xa0/0xa8 (P) [ 459.079335] vc4_bo_dec_usecnt+0x30/0x118 [vc4] [ 459.079371] vc4_async_page_flip_complete_with_cleanup+0xa0/0xc4 [vc4] [ 459.079395] dma_fence_signal_timestamp_locked+0xb0/0x12c [ 459.079408] dma_fence_signal+0x3c/0x6c [ 459.079416] vc4_irq_render_job_done+0x24/0xbc [vc4] [ 459.079440] vc4_irq+0x120/0x138 [vc4] This could happen when userspace removes the old FB and closes its GEM handle while the flip is still pending. Decrement the BO usecnt before releasing the old FB reference. Do this by unifying the two fence callbacks and only decrementing the BO usecnt in VC4_GEN_4. Cc: stable@vger.kernel.org Fixes: 4d12c36fb73b ("drm/vc4: crtc: Move the BO handling out of common page-flip callback") Reviewed-by: Iago Toral Quiroga <itoral@igalia.com> Link: https://patch.msgid.link/20261114-vc4-async-flip-fixes-v2-1-d33cbe99ed5d@igalia.com Signed-off-by: Maíra Canal <mcanal@igalia.com>
Diffstat (limited to 'rust/kernel/alloc/allocator')
0 files changed, 0 insertions, 0 deletions