Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10586653ybi; Thu, 25 Jul 2019 01:59:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqxT8x1hY1DyI2nrSWGvjqqBrdLgQH9WZJj736iEJpJUIW+iyLR/5Q1X8vlgDN0pvUpiFlf1 X-Received: by 2002:a17:902:86:: with SMTP id a6mr3018307pla.244.1564045190154; Thu, 25 Jul 2019 01:59:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564045190; cv=none; d=google.com; s=arc-20160816; b=mMfRrZn6l/4Evy+VKdFFxFJkQtfg96LjafzWgsdiRwcahVHEZzqr9mjcsRBKDkw/Ql s+r7ZDBzVTBHf06++gRUnPTFlFs7btLxU6QM0acPNGSqwt32Ok46Sdz7zhxTas9Rxi7p Ilm+gCpBq2CTC9j7H0HP43kbcQpoe2ChtkDxh/vZPSOmspsuvd8u7NG9zwIds7WuiJne Rp9Z2ZYN+C0BJ8NjApxo3bmA/ppWs30p1cWC+vQSvLFCOQUbaOFu7ft7319oVKk7Y3SO 1oDqheGpK57QSEfrVxtEexSHzqksLZ6lvauzQbG04nnqczwoOgkXL0RGqsffsNhNkxw0 0Vyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZDcDdDqGs4sJvhFSzf8A/V/mVsDQ2LnLVldjWrArtC8=; b=kg2wm66gvCY8AuicKn0oKjwJCuUQqvonqGNYwr15IQ5nK/dXnMkzxgob2Qz8R8FbRw bGTezU3f5ScxLJFpXx11k2EG5ef9j/tDuDlEupJs5OcqrfA0WSG8xU+EhasyMh/zlYkz EZNwLCFVK3fNcil20tS/gI7Z4iUSk7WtT4teFS6/MN9Zc5/CYLlPGDbkwJ++LXMwxgfC xux/vyrNWBHfSsJUF9eFIBja3e4eRfNW3x8PaMg9qYs6Yp0IKJD0ptGR4yhlPR+S4b7Z sbU8E6oIx83lCCMkhWBW74Qegmj+JN0MCRf6Ntw549vtU6iaUvmvBtLY+Jaxegfg7OUb GxZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=drge6BOz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d4si18478657pgm.357.2019.07.25.01.58.59; Thu, 25 Jul 2019 01:59:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=drge6BOz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392888AbfGXUSK (ORCPT + 99 others); Wed, 24 Jul 2019 16:18:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:57782 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403764AbfGXTte (ORCPT ); Wed, 24 Jul 2019 15:49:34 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5853A20659; Wed, 24 Jul 2019 19:49:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563997773; bh=hGM5dwc1nx3svMCBmeXexp4BS03qmOeo5AiQFguF6+U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=drge6BOzEv/l/7BbzEjC7EhL0zWfIGD1pL1U70ABB2Ireq+aYFDiX9s1A5mNx0gbO 388+SaBrFde1KxQnv66fO0aCrwuPdjdBNSbX95OPLX/yLaldPzhz6BjcrOrTXz7Pgq AZhk57Od9PUNIe4GvJXlpyCa73hfV79PS93JecL4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Andr=C3=A9=20Almeida?= , Helen Koike , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.1 138/371] media: vimc: cap: check v4l2_fill_pixfmt return value Date: Wed, 24 Jul 2019 21:18:10 +0200 Message-Id: <20190724191735.339416272@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191724.382593077@linuxfoundation.org> References: <20190724191724.382593077@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 77ae46e11df5c96bb4582633851f838f5d954df4 ] v4l2_fill_pixfmt() returns -EINVAL if the pixelformat used as parameter is invalid or if the user is trying to use a multiplanar format with the singleplanar API. Currently, the vimc_cap_try_fmt_vid_cap() returns such value, but vimc_cap_s_fmt_vid_cap() is ignoring it. Fix that and returns an error value if vimc_cap_try_fmt_vid_cap() has failed. Signed-off-by: André Almeida Suggested-by: Helen Koike Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/vimc/vimc-capture.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/vimc/vimc-capture.c b/drivers/media/platform/vimc/vimc-capture.c index ea869631a3f6..bbc16072ec16 100644 --- a/drivers/media/platform/vimc/vimc-capture.c +++ b/drivers/media/platform/vimc/vimc-capture.c @@ -130,12 +130,15 @@ static int vimc_cap_s_fmt_vid_cap(struct file *file, void *priv, struct v4l2_format *f) { struct vimc_cap_device *vcap = video_drvdata(file); + int ret; /* Do not change the format while stream is on */ if (vb2_is_busy(&vcap->queue)) return -EBUSY; - vimc_cap_try_fmt_vid_cap(file, priv, f); + ret = vimc_cap_try_fmt_vid_cap(file, priv, f); + if (ret) + return ret; dev_dbg(vcap->dev, "%s: format update: " "old:%dx%d (0x%x, %d, %d, %d, %d) " -- 2.20.1