Skip to content

Commit afe3828

Browse files
mszyprowChristianKoenigAMD
authored andcommitted
udmabuf: use sgtable-based scatterlist wrappers
Use common wrappers operating directly on the struct sg_table objects to fix incorrect use of scatterlists sync calls. dma_sync_sg_for_*() functions have to be called with the number of elements originally passed to dma_map_sg_*() function, not the one returned in sgtable's nents. Fixes: 1ffe095 ("udmabuf: fix dma-buf cpu access") CC: [email protected] Signed-off-by: Marek Szyprowski <[email protected]> Acked-by: Vivek Kasireddy <[email protected]> Reviewed-by: Christian König <[email protected]> Signed-off-by: Christian König <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent aa3f93c commit afe3828

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/dma-buf/udmabuf.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,7 @@ static int begin_cpu_udmabuf(struct dma_buf *buf,
264264
ubuf->sg = NULL;
265265
}
266266
} else {
267-
dma_sync_sg_for_cpu(dev, ubuf->sg->sgl, ubuf->sg->nents,
268-
direction);
267+
dma_sync_sgtable_for_cpu(dev, ubuf->sg, direction);
269268
}
270269

271270
return ret;
@@ -280,7 +279,7 @@ static int end_cpu_udmabuf(struct dma_buf *buf,
280279
if (!ubuf->sg)
281280
return -EINVAL;
282281

283-
dma_sync_sg_for_device(dev, ubuf->sg->sgl, ubuf->sg->nents, direction);
282+
dma_sync_sgtable_for_device(dev, ubuf->sg, direction);
284283
return 0;
285284
}
286285

0 commit comments

Comments
 (0)