[media] omap3isp: queue: fail QBUF if user buffer is too small
authorMichael Jones <michael.jones@matrix-vision.de>
Tue, 9 Aug 2011 06:42:20 +0000 (08:42 +0200)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sun, 11 Sep 2011 12:49:27 +0000 (09:49 -0300)
Add buffer length check to sanity checks for USERPTR QBUF.

Signed-off-by: Michael Jones <michael.jones@matrix-vision.de>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/omap3isp/ispqueue.c

index 9c317148205f82a73cb774607ca0a2ea412d2ea6..9bebb1e57aab0dac17e8bccbb6e55cf1566661df 100644 (file)
@@ -867,6 +867,10 @@ int omap3isp_video_queue_qbuf(struct isp_video_queue *queue,
        if (buf->state != ISP_BUF_STATE_IDLE)
                goto done;
 
+       if (vbuf->memory == V4L2_MEMORY_USERPTR &&
+           vbuf->length < buf->vbuf.length)
+               goto done;
+
        if (vbuf->memory == V4L2_MEMORY_USERPTR &&
            vbuf->m.userptr != buf->vbuf.m.userptr) {
                isp_video_buffer_cleanup(buf);