From patchwork Fri Jul 28 12:33:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 9868659 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 469C260382 for ; Fri, 28 Jul 2017 12:33:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 42BAE288DD for ; Fri, 28 Jul 2017 12:33:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 37A14288DC; Fri, 28 Jul 2017 12:33:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_SPAM,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DC5F4288CD for ; Fri, 28 Jul 2017 12:33:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751722AbdG1Mdb (ORCPT ); Fri, 28 Jul 2017 08:33:31 -0400 Received: from mout.gmx.net ([212.227.15.19]:53476 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751673AbdG1Mda (ORCPT ); Fri, 28 Jul 2017 08:33:30 -0400 Received: from axis700.grange ([87.78.105.5]) by mail.gmx.com (mrgmx002 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MRWzQ-1d8UzY3en2-00Seve for ; Fri, 28 Jul 2017 14:33:28 +0200 Received: from 200r.grange (200r.grange [192.168.1.16]) by axis700.grange (Postfix) with ESMTP id 231468B111 for ; Fri, 28 Jul 2017 14:30:58 +0200 (CEST) Received: from lyakh (uid 1000) (envelope-from g.liakhovetski@gmx.de) id 802637 by 200r.grange (DragonFly Mail Agent v0.9); Fri, 28 Jul 2017 14:33:25 +0200 From: Guennadi Liakhovetski To: linux-media@vger.kernel.org Cc: Laurent Pinchart , Hans Verkuil , Guennadi Liakhovetski Subject: [PATCH 1/6 v5] UVC: fix .queue_setup() to check the number of planes Date: Fri, 28 Jul 2017 14:33:20 +0200 Message-Id: <1501245205-15802-2-git-send-email-g.liakhovetski@gmx.de> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1501245205-15802-1-git-send-email-g.liakhovetski@gmx.de> References: <1501245205-15802-1-git-send-email-g.liakhovetski@gmx.de> X-Provags-ID: V03:K0:BO+EjHe3zJ6zV4YM0mIze8RCAB7CIq7ylKLvsrPLDHY565xgfVr WPbG8uwA8QMi8sDJb0q1IgX6Vd67gdHlhikyKpI01sNDM5VrvDVkDpGClrWVJPBbpl91xdD P7mefzpfHDSyKSq8qG8EmNPcUwC+W9ZyF6Ajek9LCQZt9eqma1fCxpjeIU2XHLKWnnOxQGf wLAOWVFozrUYyKZTQ6tQQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:Lrhse010h9U=:6VAc6OWFvRuSlVBgzpy5Vy Uzbotbn3WJYT4bnMvmz/e563zC1VfS7v7T0RB1POgF78NNKh/xuINJOSyF1DBpStclRHa9HL2 XPgcwLfgSIHjVzxNEvhInGzKj/FlZFh2Jn0vF0yNoUkpIwMnEKAzWnW22ij0MQ3L9rSohbSsB UYCpgUabbvSrTdFbXRsL1G4sUY5a5z1dwPhZIkprmmV7nJdMw7AqxYe7Ial5cRB/Y1Z8qHEl8 4VOEfzpmLqBtBvAu3luEKpmcUut00W2lhkRWaymlQJrrG1na5mMGouWsP236kJTGOehRdcgGk RhhBVn6kNJ/oHnk2OV6Q7Cug/PVTajpFrXvrV5QGZxFFE8SoCMJjGOxp8azY4s/igtiC1TYnJ 9e3vm618mOAk0cMB3/jSLUgpVAJM1LdqO2DZkh6vUXj6BIeTymvsu5nWLoYwGaOzKR5ZhL7Gc koYKXJsymcZhU3kbZXVSYYHPK8zjjFmrFBRnl13i2iQEZPaaky18tp07ztm8+M4/Q0Wa95M6X OmhDj8q+oKhsMEYwNrKvqQbMdxUrQFId2fjbWYeWqCbgXEifgh9PjP2uHTM338w8Z2xxaSr4d uaJG/7sh/kVgH872cp/Q9YXbdDOFbFCO9ejdUj8rd8Gdxg+PzFVEQa7yQzYvBUvtHzMPMMykM q7UbSJqf1Z3072DJLBR8ncYaJQ3LZNdu7C8pTJDPrJ0mlGNdi+vsrzf/fzhj0olnf2/UxkFc3 h2Mr3XNhQGAdrf1yAIGEEdWSevkofu1DRVjpSrDMK6XXAKEkr8kNZCkFgGSgNYWWdsAVGSTnd rWJwLfSWExUu18hHVmm5YZWQ57uQQ== Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP According to documentation of struct vb2_ops the .queue_setup() callback should return an error if the number of planes parameter contains an invalid value on input. Fix this instead of ignoring the value. Signed-off-by: Guennadi Liakhovetski Reviewed-by: Laurent Pinchart --- drivers/media/usb/uvc/uvc_queue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/usb/uvc/uvc_queue.c b/drivers/media/usb/uvc/uvc_queue.c index aa21997..371a4ad 100644 --- a/drivers/media/usb/uvc/uvc_queue.c +++ b/drivers/media/usb/uvc/uvc_queue.c @@ -84,7 +84,7 @@ static int uvc_queue_setup(struct vb2_queue *vq, /* Make sure the image size is large enough. */ if (*nplanes) - return sizes[0] < size ? -EINVAL : 0; + return sizes[0] < size || *nplanes != 1 ? -EINVAL : 0; *nplanes = 1; sizes[0] = size; return 0;