Skip to content

Commit

Permalink
dma-buf: Fix one use-after-free of fence
Browse files Browse the repository at this point in the history
Need get the new fence when we replace the old one.

Fixes: 047a1b8 ("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>
  • Loading branch information
xinhui pan authored and Christian König committed Jul 7, 2022
1 parent 9fc33ea commit 7c1aeba
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/dma-buf/dma-resv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 7c1aeba

Please sign in to comment.