Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2578dfb7 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Mauro Carvalho Chehab
Browse files

[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: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent c4f0b78a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;
	}