Skip to content

Commit c24a8c2

Browse files
mszyprowjfvogel
authored andcommitted
udmabuf: use sgtable-based scatterlist wrappers
commit afe382843717d44b24ef5014d57dcbaab75a4052 upstream. 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] Signed-off-by: Greg Kroah-Hartman <[email protected]> (cherry picked from commit 5ec6148cb83782636e4857789d5b7c0194a6fb91) Signed-off-by: Jack Vogel <[email protected]>
1 parent a7492fa commit c24a8c2

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
@@ -223,8 +223,7 @@ static int begin_cpu_udmabuf(struct dma_buf *buf,
223223
ubuf->sg = NULL;
224224
}
225225
} else {
226-
dma_sync_sg_for_cpu(dev, ubuf->sg->sgl, ubuf->sg->nents,
227-
direction);
226+
dma_sync_sgtable_for_cpu(dev, ubuf->sg, direction);
228227
}
229228

230229
return ret;
@@ -239,7 +238,7 @@ static int end_cpu_udmabuf(struct dma_buf *buf,
239238
if (!ubuf->sg)
240239
return -EINVAL;
241240

242-
dma_sync_sg_for_device(dev, ubuf->sg->sgl, ubuf->sg->nents, direction);
241+
dma_sync_sgtable_for_device(dev, ubuf->sg, direction);
243242
return 0;
244243
}
245244

0 commit comments

Comments
 (0)