Commit 3c7470b6 authored by John Hubbard's avatar John Hubbard Committed by Linus Torvalds

media/v4l2-core: set pages dirty upon releasing DMA buffers

After DMA is complete, and the device and CPU caches are synchronized,
it's still required to mark the CPU pages as dirty, if the data was
coming from the device.  However, this driver was just issuing a bare
put_page() call, without any set_page_dirty*() call.

Fix the problem, by calling set_page_dirty_lock() if the CPU pages were
potentially receiving data from the device.

Link: default avatarJohn Hubbard <>
Reviewed-by: default avatarChristoph Hellwig <>
Acked-by: default avatarHans Verkuil <>
Cc: Mauro Carvalho Chehab <>
Cc: <>
Cc: Alex Williamson <>
Cc: Aneesh Kumar K.V <>
Cc: Björn Töpel <>
Cc: Daniel Vetter <>
Cc: Dan Williams <>
Cc: Ira Weiny <>
Cc: Jan Kara <>
Cc: Jason Gunthorpe <>
Cc: Jason Gunthorpe <>
Cc: Jens Axboe <>
Cc: Jerome Glisse <>
Cc: Jonathan Corbet <>
Cc: Kirill A. Shutemov <>
Cc: Leon Romanovsky <>
Cc: Mike Rapoport <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 4789fcdd
......@@ -349,8 +349,11 @@ int videobuf_dma_free(struct videobuf_dmabuf *dma)
if (dma->pages) {
for (i = 0; i < dma->nr_pages; i++)
for (i = 0; i < dma->nr_pages; i++) {
if (dma->direction == DMA_FROM_DEVICE)
dma->pages = NULL;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment