Skip to content

Commit 9dd2f13

Browse files
matt-auldjfvogel
authored andcommitted
drm/amdgpu/dma_buf: fix page_link check
commit c0dd8a9253fadfb8e5357217d085f1989da4ef0a upstream. The page_link lower bits of the first sg could contain something like SG_END, if we are mapping a single VRAM page or contiguous blob which fits into one sg entry. Rather pull out the struct page, and use that in our check to know if we mapped struct pages vs VRAM. Fixes: f44ffd6 ("drm/amdgpu: add support for exporting VRAM using DMA-buf v3") Signed-off-by: Matthew Auld <[email protected]> Cc: Christian König <[email protected]> Cc: [email protected] Cc: <[email protected]> # v5.8+ Reviewed-by: Christian König <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> (cherry picked from commit 91b646a0b2cbd1d6d1b0be49ae780b6d2ea6011c) Signed-off-by: Jack Vogel <[email protected]>
1 parent 730f3bd commit 9dd2f13

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ static void amdgpu_dma_buf_unmap(struct dma_buf_attachment *attach,
181181
struct sg_table *sgt,
182182
enum dma_data_direction dir)
183183
{
184-
if (sgt->sgl->page_link) {
184+
if (sg_page(sgt->sgl)) {
185185
dma_unmap_sgtable(attach->dev, sgt, dir, 0);
186186
sg_free_table(sgt);
187187
kfree(sgt);

0 commit comments

Comments
 (0)