[media] ivtv: Convert to get_user_pages_unlocked()
authorJan Kara <jack@suse.cz>
Tue, 6 Oct 2015 09:24:30 +0000 (06:24 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Tue, 20 Oct 2015 17:59:01 +0000 (15:59 -0200)
Convert ivtv_yuv_prep_user_dma() to use get_user_pages_unlocked() so
that we don't unnecessarily leak knowledge about mm locking into drivers
code.

CC: Andy Walls <awalls@md.metrocast.net>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/pci/ivtv/ivtv-yuv.c

index 2ad65eb29832754b54a5d190257cadd5d6a09031..2b8e7b2f2b865fdd616356fa764a2d3fbe8e901f 100644 (file)
@@ -75,15 +75,15 @@ static int ivtv_yuv_prep_user_dma(struct ivtv *itv, struct ivtv_user_dma *dma,
        ivtv_udma_get_page_info (&uv_dma, (unsigned long)args->uv_source, 360 * uv_decode_height);
 
        /* Get user pages for DMA Xfer */
-       down_read(&current->mm->mmap_sem);
-       y_pages = get_user_pages(current, current->mm, y_dma.uaddr, y_dma.page_count, 0, 1, &dma->map[0], NULL);
+       y_pages = get_user_pages_unlocked(current, current->mm,
+                               y_dma.uaddr, y_dma.page_count, 0, 1,
+                               &dma->map[0]);
        uv_pages = 0; /* silence gcc. value is set and consumed only if: */
        if (y_pages == y_dma.page_count) {
-               uv_pages = get_user_pages(current, current->mm,
-                                         uv_dma.uaddr, uv_dma.page_count, 0, 1,
-                                         &dma->map[y_pages], NULL);
+               uv_pages = get_user_pages_unlocked(current, current->mm,
+                                       uv_dma.uaddr, uv_dma.page_count, 0, 1,
+                                       &dma->map[y_pages]);
        }
-       up_read(&current->mm->mmap_sem);
 
        if (y_pages != y_dma.page_count || uv_pages != uv_dma.page_count) {
                int rc = -EFAULT;