From: Hans Verkuil <hans.verkuil@xxxxxxxxx> The driver might touch the data after mapping in buf_prepare, so make sure it is synced for cpu. Signed-off-by: Hans Verkuil <hans.verkuil@xxxxxxxxx> --- drivers/media/v4l2-core/videobuf2-dma-contig.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/media/v4l2-core/videobuf2-dma-contig.c b/drivers/media/v4l2-core/videobuf2-dma-contig.c index 4a02ade..dd39651 100644 --- a/drivers/media/v4l2-core/videobuf2-dma-contig.c +++ b/drivers/media/v4l2-core/videobuf2-dma-contig.c @@ -666,6 +666,12 @@ static void *vb2_dc_get_userptr(void *alloc_ctx, unsigned long vaddr, goto fail_map_sg; } + /* + * After mapping the buffer we have to sync it for cpu since the + * buf_prepare() callback might need to access/modify the buffer. + */ + dma_sync_sg_for_cpu(buf->dev, sgt->sgl, sgt->nents, buf->dma_dir); + buf->dma_addr = sg_dma_address(sgt->sgl); buf->size = size; buf->dma_sgt = sgt; -- 2.1.1 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html