From patchwork Thu Mar 19 22:14:32 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TsODwqltZXRoIE3Dg8KhcnRvbg==?= X-Patchwork-Id: 13168 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n2JMFZCM026991 for ; Thu, 19 Mar 2009 22:15:35 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751143AbZCSWOp (ORCPT ); Thu, 19 Mar 2009 18:14:45 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758336AbZCSWOp (ORCPT ); Thu, 19 Mar 2009 18:14:45 -0400 Received: from mail00d.mail.t-online.hu ([84.2.42.5]:63461 "EHLO mail00d.mail.t-online.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751143AbZCSWOo (ORCPT ); Thu, 19 Mar 2009 18:14:44 -0400 Received: from [192.168.1.65] (dsl54029F41.pool.t-online.hu [84.2.159.65]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail00d.mail.t-online.hu (Postfix) with ESMTPSA id 20850758773; Thu, 19 Mar 2009 23:14:24 +0100 (CET) Message-ID: <49C2C3C8.3000300@freemail.hu> Date: Thu, 19 Mar 2009 23:14:32 +0100 From: =?UTF-8?B?TsOpbWV0aCBNw6FydG9u?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; hu-HU; rv:1.8.1.16) Gecko/20080702 SeaMonkey/1.1.11 MIME-Version: 1.0 To: Jean-Francois Moine CC: Trent Piepho , David Ellingsworth , linux-media@vger.kernel.org, LKML Subject: Re: [PATCH] gspca: add missing .type field check in VIDIOC_G_PARM References: <49C133F6.3020202@freemail.hu> <30353c3d0903181445i409604e8r33678f7ce09d0288@mail.gmail.com> <49C1DD0C.4050500@freemail.hu> In-Reply-To: X-DCC-mail.t-online.hu-Metrics: mail00d.mail.t-online.hu 32720; Body=5 Fuz1=5 Fuz2=5 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Márton Németh The gspca webcam driver does not check the .type field of struct v4l2_streamparm. This field is an input parameter for the driver according to V4L2 API specification, revision 0.24 [1]. Add the missing check. The missing check was recognised by v4l-test 0.10 [2] together with gspca_sunplus driver and with "Trust 610 LCD POWERC@M ZOOM" webcam. This patch was verified also with v4l-test 0.10. The memset() is not necessary as V4L2 framework already have done this task when vidioc_g_parm() is called. References: [1] V4L2 API specification, revision 0.24 http://v4l2spec.bytesex.org/spec/r11680.htm [2] v4l-test: Test environment for Video For Linux Two API http://v4l-test.sourceforge.net/ Signed-off-by: Márton Németh --- -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- linux-2.6.29-rc8/drivers/media/video/gspca/gspca.c.orig 2009-03-14 12:29:38.000000000 +0100 +++ linux-2.6.29-rc8/drivers/media/video/gspca/gspca.c 2009-03-19 20:38:22.000000000 +0100 @@ -1320,8 +1320,9 @@ static int vidioc_g_parm(struct file *fi { struct gspca_dev *gspca_dev = priv; - memset(parm, 0, sizeof *parm); - parm->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + parm->parm.capture.readbuffers = gspca_dev->nbufread; if (gspca_dev->sd_desc->get_streamparm) {