Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dma-buf: Fix one use-after-free of fence

Need get the new fence when we replace the old one.

Fixes: 047a1b877ed48 ("dma-buf & drm/amdgpu: remove dma_resv workaround")
Signed-off-by: xinhui pan <xinhui.pan@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220707080241.20060-1-xinhui.pan@amd.com
Signed-off-by: Christian König <christian.koenig@amd.com>

authored by

xinhui pan and committed by
Christian König
7c1aeba7 9fc33eaa

+1 -1
+1 -1
drivers/dma-buf/dma-resv.c
··· 343 343 if (old->context != context) 344 344 continue; 345 345 346 - dma_resv_list_set(list, i, replacement, usage); 346 + dma_resv_list_set(list, i, dma_fence_get(replacement), usage); 347 347 dma_fence_put(old); 348 348 } 349 349 }