Skip to content

Commit

Permalink
[media] omap3isp: queue: Don't corrupt buf->npages when get_user_page…
Browse files Browse the repository at this point in the history
…s() 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>
  • Loading branch information
Laurent Pinchart authored and Mauro Carvalho Chehab committed Apr 19, 2011
1 parent c4f0b78 commit 2578dfb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/media/video/omap3isp/ispqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 2578dfb

Please sign in to comment.