OSDN Git Service

dma-buf: Fix one use-after-free of fence
authorxinhui pan <xinhui.pan@amd.com>
Thu, 7 Jul 2022 08:02:41 +0000 (16:02 +0800)
committerChristian König <christian.koenig@amd.com>
Thu, 7 Jul 2022 08:24:59 +0000 (10:24 +0200)
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>
drivers/dma-buf/dma-resv.c

index 0cce6e4..205acb2 100644 (file)
@@ -343,7 +343,7 @@ void dma_resv_replace_fences(struct dma_resv *obj, uint64_t context,
                if (old->context != context)
                        continue;
 
-               dma_resv_list_set(list, i, replacement, usage);
+               dma_resv_list_set(list, i, dma_fence_get(replacement), usage);
                dma_fence_put(old);
        }
 }