From patchwork Tue Aug 9 06:42:20 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Jones X-Patchwork-Id: 1047612 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p796hOXT006969 for ; Tue, 9 Aug 2011 06:43:24 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751241Ab1HIGnW (ORCPT ); Tue, 9 Aug 2011 02:43:22 -0400 Received: from mail2.matrix-vision.com ([85.214.244.251]:45089 "EHLO mail2.matrix-vision.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751114Ab1HIGnV (ORCPT ); Tue, 9 Aug 2011 02:43:21 -0400 Received: from mail2.matrix-vision.com (localhost [127.0.0.1]) by mail2.matrix-vision.com (Postfix) with ESMTP id 7C6EC4059C; Tue, 9 Aug 2011 08:43:20 +0200 (CEST) Received: from erinome (g2.matrix-vision.com [80.152.136.245]) by mail2.matrix-vision.com (Postfix) with ESMTPA id 4445A3F66C; Tue, 9 Aug 2011 08:43:20 +0200 (CEST) Received: from erinome (localhost [127.0.0.1]) by erinome (Postfix) with ESMTP id AA7A66F8A; Tue, 9 Aug 2011 08:43:19 +0200 (CEST) Received: by erinome (Postfix, from userid 108) id 99C586F9C; Tue, 9 Aug 2011 08:43:19 +0200 (CEST) Received: from ap437-joe.intern.matrix-vision.de (host65-46.intern.matrix-vision.de [192.168.65.46]) by erinome (Postfix) with ESMTPA id 6E0EF6F8A; Tue, 9 Aug 2011 08:43:19 +0200 (CEST) From: Michael Jones To: linux-media@vger.kernel.org Cc: Laurent Pinchart , Mauro Carvalho Chehab Subject: [PATCH v2] [media] omap3isp: queue: fail QBUF if user buffer is too small Date: Tue, 9 Aug 2011 08:42:20 +0200 Message-Id: <1312872140-7517-1-git-send-email-michael.jones@matrix-vision.de> X-Mailer: git-send-email 1.7.6 In-Reply-To: <1312472437-26231-1-git-send-email-michael.jones@matrix-vision.de> References: <1312472437-26231-1-git-send-email-michael.jones@matrix-vision.de> X-MV-Disclaimer: true (erinome) X-AV-Checked: ClamAV using ClamSMTP (erinome) X-AV-Checked: ClamAV using ClamSMTP (mail2) Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Tue, 09 Aug 2011 06:43:24 +0000 (UTC) Add buffer length check to sanity checks for USERPTR QBUF Signed-off-by: Michael Jones Acked-by: Laurent Pinchart --- Changes for v2: - only check when V4L2_MEMORY_USERPTR drivers/media/video/omap3isp/ispqueue.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/drivers/media/video/omap3isp/ispqueue.c b/drivers/media/video/omap3isp/ispqueue.c index 9c31714..9bebb1e 100644 --- a/drivers/media/video/omap3isp/ispqueue.c +++ b/drivers/media/video/omap3isp/ispqueue.c @@ -868,6 +868,10 @@ int omap3isp_video_queue_qbuf(struct isp_video_queue *queue, 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); buf->vbuf.m.userptr = vbuf->m.userptr;