Skip to content

Commit ae01228

Browse files
matt-auldvijay-suman
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 4941966558a0b23200d66976c4b35e5ce1b3da0a) Signed-off-by: Vijayendra Suman <[email protected]>
1 parent 826068b commit ae01228

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
@@ -225,7 +225,7 @@ static void amdgpu_dma_buf_unmap(struct dma_buf_attachment *attach,
225225
struct sg_table *sgt,
226226
enum dma_data_direction dir)
227227
{
228-
if (sgt->sgl->page_link) {
228+
if (sg_page(sgt->sgl)) {
229229
dma_unmap_sgtable(attach->dev, sgt, dir, 0);
230230
sg_free_table(sgt);
231231
kfree(sgt);

0 commit comments

Comments
 (0)