mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
[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>
This commit is contained in:
parent
c4f0b78ad5
commit
2578dfb7f7
@ -339,7 +339,7 @@ static int isp_video_buffer_prepare_user(struct isp_video_buffer *buf)
|
|||||||
up_read(¤t->mm->mmap_sem);
|
up_read(¤t->mm->mmap_sem);
|
||||||
|
|
||||||
if (ret != buf->npages) {
|
if (ret != buf->npages) {
|
||||||
buf->npages = ret;
|
buf->npages = ret < 0 ? 0 : ret;
|
||||||
isp_video_buffer_cleanup(buf);
|
isp_video_buffer_cleanup(buf);
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user