media: pci/ivtv: remove FOLL_FORCE usage
authorDavid Hildenbrand <david@redhat.com>
Wed, 16 Nov 2022 10:26:54 +0000 (11:26 +0100)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 30 Nov 2022 23:58:59 +0000 (15:58 -0800)
FOLL_FORCE is really only for ptrace access. R/O pinning a page is
supposed to fail if the VMA misses proper access permissions (no VM_READ).

Let's just remove FOLL_FORCE usage here; there would have to be a pretty
good reason to allow arbitrary drivers to R/O pin pages in a PROT_NONE
VMA. Most probably, FOLL_FORCE usage is just some legacy leftover.

Link: https://lkml.kernel.org/r/20221116102659.70287-16-david@redhat.com
Signed-off-by: David Hildenbrand <david@redhat.com>
Acked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Cc: Andy Walls <awalls@md.metrocast.net>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/media/pci/ivtv/ivtv-udma.c
drivers/media/pci/ivtv/ivtv-yuv.c

index 210be82..99b9f55 100644 (file)
@@ -115,7 +115,7 @@ int ivtv_udma_setup(struct ivtv *itv, unsigned long ivtv_dest_addr,
 
        /* Pin user pages for DMA Xfer */
        err = pin_user_pages_unlocked(user_dma.uaddr, user_dma.page_count,
-                       dma->map, FOLL_FORCE);
+                       dma->map, 0);
 
        if (user_dma.page_count != err) {
                IVTV_DEBUG_WARN("failed to map user pages, returned %d instead of %d\n",
index 4ba10c3..582146f 100644 (file)
@@ -63,12 +63,11 @@ static int ivtv_yuv_prep_user_dma(struct ivtv *itv, struct ivtv_user_dma *dma,
 
        /* Pin user pages for DMA Xfer */
        y_pages = pin_user_pages_unlocked(y_dma.uaddr,
-                       y_dma.page_count, &dma->map[0], FOLL_FORCE);
+                       y_dma.page_count, &dma->map[0], 0);
        uv_pages = 0; /* silence gcc. value is set and consumed only if: */
        if (y_pages == y_dma.page_count) {
                uv_pages = pin_user_pages_unlocked(uv_dma.uaddr,
-                               uv_dma.page_count, &dma->map[y_pages],
-                               FOLL_FORCE);
+                               uv_dma.page_count, &dma->map[y_pages], 0);
        }
 
        if (y_pages != y_dma.page_count || uv_pages != uv_dma.page_count) {