> qxl_release_free() used to check release->base.ops to find out whether
> the embedded dma_fence had been initialized. Since commit 2bcbc706dfa0
> ("dma-buf: add dma_fence_was_initialized function v2") it uses a flag
> in fence->flags instead, but qxl_release_alloc() allocates the release
> with kmalloc(), so the flags contain stale data.
> 
> Cursor releases never go through dma_fence_init(), so with a stale flag
> qxl_release_free() takes the initialized-fence path and calls
> dma_fence_signal() on a garbage fence->lock, triggering:
> 
>   BUG: KASAN: slab-use-after-free in _raw_spin_lock_irqsave+0x7b/0xe0
>   Write of size 4 at addr ffff888010462700 by task kworker/3:1/91
> 
>   CPU: 3 UID: 0 PID: 91 Comm: kworker/3:1
>     Not tainted 7.3.0-00341-gf47d223627f8-dirty #556 PREEMPT(lazy)
> [ ... ]
> 
> Fixes: 2bcbc706dfa0 ("dma-buf: add dma_fence_was_initialized function v2")
> Assisted-by: claude-Sonnet 5.5
> Cc: Christian König <[email protected]>
> Signed-off-by: Óscar Megía López <[email protected]>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · 
https://sashiko.dev/#/patchset/[email protected]?part=1

Reply via email to