summaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2011-04-07 13:30:14 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-04-19 11:29:56 -0300
commit2578dfb7f767076baf04eaf5fbf35a75afb9a1a7 (patch)
tree72dd9590490c76472c9a518249c219b91a4008ec /drivers/media/video
parentc4f0b78ad5d0e76caaeb5c2349c2613728c816bc (diff)
[media] omap3isp: queue: Don't corrupt buf->npages when get_user_pages() fails
get_user_pages() can return a negative error code when it fails. Set buf->npages to 0 in that case, to prevent isp_video_buffer_cleanup() from releasing invalid pages. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/omap3isp/ispqueue.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/video/omap3isp/ispqueue.c b/drivers/media/video/omap3isp/ispqueue.c
index c91e56a5791..9c317148205 100644
--- a/drivers/media/video/omap3isp/ispqueue.c
+++ b/drivers/media/video/omap3isp/ispqueue.c
@@ -339,7 +339,7 @@ static int isp_video_buffer_prepare_user(struct isp_video_buffer *buf)
up_read(&current->mm->mmap_sem);
if (ret != buf->npages) {
- buf->npages = ret;
+ buf->npages = ret < 0 ? 0 : ret;
isp_video_buffer_cleanup(buf);
return -EFAULT;
}