Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3784627ybi; Mon, 29 Jul 2019 12:33:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqyb7DvcWhElcO0z1EyCbsYwzEjjxNVxFjnhA/c9xxSsUl850l24ojwPZh9x5Xogas323I0F X-Received: by 2002:a62:35c6:: with SMTP id c189mr38217005pfa.96.1564428837044; Mon, 29 Jul 2019 12:33:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564428837; cv=none; d=google.com; s=arc-20160816; b=p+/E5SruEpZ/v+RTqJTJdAfvD4YJ1CkV0hthRznhcDZEaljY06vgUhhSagD81wckcm thvrTLR6rz6Lm2WYAt/vk3byN9nQOSZY2YHOgFR/4MImDBFtoxC24Ti0T96akR/QW5h3 wdlg/bP28dBceL2ZihNRURRywdGqzC0YCt45d6tqhGu8WiG0hZ/uIYcWjyytHqtz79Eq U52JUHPq9ofpS523gv6ijSQiNnUEiidNcF0oxn4yw+LbUL+XKqJM6RS6afFCbK/BefXj FWytHJ8uoKZS7Fp+XSFOsBK/i+2PUWIHmCO/Dqz4Ya5wWOJCDT64RsqTW2DPiodnlAKx GHyw== 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=Bi7LI7uhIEGzxpvd2e1fRogx9pKRI7NxB3G9xAQrbl8=; b=UR5se6+1yocTQYDl5cwSLOf8vsbiDYKiBjdzf+2tqDqPFhZPFdbUQKGIQamflEVXDM nILcESxkHGQNICouTZstUiIukzmKHqYNTZXAq2e/hmJxlxfrXR4MAZvjmh9dh73qytqi U4Gfo2ycesB34tNxeA/q5IyG1eozgpL20DkqGRl2sRvlVcOfRNgX1kHZCX7nm7hZLWQ8 e2YhSm1rbS3a60WRsjUiocAtxtl2/Q2Y46kB7FW0tyHEe8TZ4XLckeIR4yb9nq9oCAzD u1PZnSRa3teEbp3EA0RTYjCsvgC6qZbcFoZk6NI2UztjbuTFBOLcOk8QDMG/FsL5SMhq rOIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ufImxB2R; 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 e5si11389442pgl.536.2019.07.29.12.33.42; Mon, 29 Jul 2019 12:33:57 -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=ufImxB2R; 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 S1729865AbfG2T1A (ORCPT + 99 others); Mon, 29 Jul 2019 15:27:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:39448 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729850AbfG2T06 (ORCPT ); Mon, 29 Jul 2019 15:26:58 -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 31E8421655; Mon, 29 Jul 2019 19:26:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564428417; bh=v6739TFzCD0dCWBYvQaUHrFGQhMc3tYKA8SZNCnX6Qs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ufImxB2RGPrzcpEgqlLYfRHyECCRd0A0NljkmByI2yG6H5vboGoBrmhssBYHg0Xd/ Lqpa7UPgxpGOgXOExcotV9aN3fN2eiKkpCff2LaAC+B1hL2OwODvYkAW4CBmf0+4DT 8EPoPYMLlpcP3B8yU7r9WB8MaSTCJBP4Azivmwd0= 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 4.14 070/293] media: vimc: cap: check v4l2_fill_pixfmt return value Date: Mon, 29 Jul 2019 21:19:21 +0200 Message-Id: <20190729190830.038735151@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190820.321094988@linuxfoundation.org> References: <20190729190820.321094988@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 a078ad18909a..091921ed09dd 100644 --- a/drivers/media/platform/vimc/vimc-capture.c +++ b/drivers/media/platform/vimc/vimc-capture.c @@ -131,12 +131,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