Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp844229pxb; Tue, 3 Nov 2020 14:11:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJyp47LypUZW2PRAN5ciNentEQ2WaZRHpwgmqSMW+/0RyPLDtA/DWsWHCCbDspdqyhA+2+3M X-Received: by 2002:a17:906:738a:: with SMTP id f10mr4568403ejl.236.1604441503501; Tue, 03 Nov 2020 14:11:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604441503; cv=none; d=google.com; s=arc-20160816; b=Mfk/q6dI4Qz6oqIxqCmo/YG1dM4SZt/JpTL1SCYiHb+s4ZGNbBmAFPfPxbrfa9gK5+ 8KEWBoGybepj4R7rO1Z0oPqc2Lh/gEhgz/vZO+NUR2XvHsXFyk/DqfP2WC4X6vVybaQ8 YEyzjJawnYf9zC2m9vVpxHpQ9tPQy/RTxVBVn0nZ1hBF7/KBB+9MNhNvSvIMBEQ3Tf5h Bz6P9U9P5wz1FcBfHE7oWKaRu/GN7MG06sd00Kr3DMFInTM5YEPXmz9oEnjkI1oaLuIT mdXAvuz0iZEvc1jjTcH2xgOfxPhtoaC0dneKvPADaIMHwOaYN5hUROsNUbHFi2QkKAy/ vOrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZMjihAkTRnZGJNJ2IR6awZvuxZaxtEwkQ/JrUhsMm60=; b=H3szyXlSbzrSAQpX085WUZtFfaiTYqY8joqNDGR1I8eFkDUtmLWoXpcuh6AIGxHvKi tJvPMtFu56bQqcllRAIZdhC/Dk869z2QTEveoy/5pB43H5omBdpMuVnqu+GAZ6Qbrk3t r1hNM+aB9Op1pbflNkPfaOcE+XCVBC2qYGo2u4J1tty0MoNu8cvE/AKe0/pl147FpvBK VHrK0XYcABIQYQCqsLjRPYXBVFW2Qj0USsS//q78BPqRKTnW389fLCjF9FpFjv05poWq IeRYNAaKhUgNFwojtRaQD6PvoH/3RnDa0gDm1G58i6Yr+EN5l7IumQ/KzcZXOIN6teE4 /Ksg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pYUyLoU5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j13si13777504edj.549.2020.11.03.14.11.20; Tue, 03 Nov 2020 14:11:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pYUyLoU5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730331AbgKCUlO (ORCPT + 99 others); Tue, 3 Nov 2020 15:41:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:52738 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729885AbgKCUlG (ORCPT ); Tue, 3 Nov 2020 15:41:06 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 A955222277; Tue, 3 Nov 2020 20:41:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604436066; bh=pMcdHwJuItTFqNgaeSfTUMX1u5Fq2/5sgs1ddk+SUoY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pYUyLoU5W9X06s083bqHSwbB4wtDDrx/U1VkXC3Wi2cCT9YkWMsBHYPkG3AVDfu45 U+JlmfdcZu3hxdsCGgL8j/dtUPvGWtDdfN10otrv0cqjUjLRlabAFiyrYvQO25rb71 6pIZrJ7qrcameKatRHSB7EkLWgJ7xMPMdD+0v89s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tomasz Figa , Xia Jiang , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.9 087/391] media: platform: Improve queue set up flow for bug fixing Date: Tue, 3 Nov 2020 21:32:18 +0100 Message-Id: <20201103203352.879044102@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203348.153465465@linuxfoundation.org> References: <20201103203348.153465465@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xia Jiang [ Upstream commit 5095a6413a0cf896ab468009b6142cb0fe617e66 ] Add checking created buffer size follow in mtk_jpeg_queue_setup(). Reviewed-by: Tomasz Figa Signed-off-by: Xia Jiang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c index 61fed1e35a005..b1ca4e3adae32 100644 --- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c +++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c @@ -571,6 +571,13 @@ static int mtk_jpeg_queue_setup(struct vb2_queue *q, if (!q_data) return -EINVAL; + if (*num_planes) { + for (i = 0; i < *num_planes; i++) + if (sizes[i] < q_data->sizeimage[i]) + return -EINVAL; + return 0; + } + *num_planes = q_data->fmt->colplanes; for (i = 0; i < q_data->fmt->colplanes; i++) { sizes[i] = q_data->sizeimage[i]; -- 2.27.0