Skip to content

Commit 2ccaaa6

Browse files
mszyprowpopcornmix
authored andcommitted
udmabuf: use sgtable-based scatterlist wrappers
commit afe3828 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: stable@vger.kernel.org Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Acked-by: Vivek Kasireddy <vivek.kasireddy@intel.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Christian König <christian.koenig@amd.com> Link: https://lore.kernel.org/r/20250507160913.2084079-3-m.szyprowski@samsung.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 7766599 commit 2ccaaa6

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)