Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1011450pxx; Tue, 27 Oct 2020 06:17:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxAugQW5jGLJHqstfWq8NMFPghkbeLXPIAz9TpJq0pfdGZpVwuXkJj8DcxzXb4+ftVmNOuy X-Received: by 2002:a17:906:c315:: with SMTP id s21mr2289002ejz.312.1603804651379; Tue, 27 Oct 2020 06:17:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603804651; cv=none; d=google.com; s=arc-20160816; b=TgeQZZ+OLkjYvdGwbiGM+/f4M35YwYJfzvV3iW4qUErGvJ5NunLa3H2CmE0mNOTocW qzBHTI62UjD1mhFK8rsE5PglywD8zP0wPl53PW5BnFRLhc0PKo/PcoJsaB6nHpkRJ9zF 0PmaVwa4saD751KP+E0qy/X1xDeknFVJJgTO9QVwZPnSMXKAKK39NhKPLwXhgMOM+TSi LwwWywRhet4NeHIXiX5delcKoTGjJ5iMtGv6aiQBHQCUHP/h1V2NC0A2CH2fE/DyY1bk MZzDd3JSJiLWh3nBz5+TjtaHAHmte7AnVfeESoe6xQHYdIC3EK87xNzPFxmuvJYNo2cw Ykfw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=qDuT69qJYjlDiScneLGR0ZeOby2NRMkG2Mjb51lgrx8=; b=InEWZbJpXU7u9ygAIBNec8G0EhvekKqUsv8ckHisRmc7qH5FDbA/RdX3xtoBR7OS5R dMo7RYL2hVPsWjk4YdKKnzs2oU+Tsq/vNYu4HIpKFkP/2ECOodA9vBcxkjRqIOwWpHCx V3wtElBJOPMsB9BlDA61F8/GVLWARXT82gdomQMYQv1VX9BJJeCY9Ve9riboLx8MqMI/ kxQ6rKxMrLy5po36F3Fb1n3f8wCoR1mS7ATGa4x637FluMhEfDurmXgytQ8IZ9FKSupo +cwTx8ExormT/sUNNh0twwjijGAgltt2UDHzaR5bCJLEHCjOruAJdklshpcH4eCYEPga ihEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=w7wf35Q0; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z8si964446eju.267.2020.10.27.06.16.53; Tue, 27 Oct 2020 06:17:31 -0700 (PDT) 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=w7wf35Q0; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2441303AbgJ0AWS (ORCPT + 99 others); Mon, 26 Oct 2020 20:22:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:33688 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2410954AbgJZXzq (ORCPT ); Mon, 26 Oct 2020 19:55:46 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3236320770; Mon, 26 Oct 2020 23:55:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603756544; bh=9t3Xistk61WoA1A0FKjUUGRtE46g0p5WJG73qvpjFDA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w7wf35Q09SzAOUrYuIzTeVJGNtspkp5qWu0PA1zJS5pJUH6ptpsZEd4pM+yn9Epyl 6WXF/oqM0Ws6c/ns9n21QB8xLwfnguuFCcov72rRMJjAzvZxhMH+N5vUYSJXIsaeVW DihSFli+jjRcyybIJvFh/rLqUnqN4a/dpir4KrgE= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Xia Jiang , Tomasz Figa , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin , linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH AUTOSEL 5.4 22/80] media: platform: Improve queue set up flow for bug fixing Date: Mon, 26 Oct 2020 19:54:18 -0400 Message-Id: <20201026235516.1025100-22-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201026235516.1025100-1-sashal@kernel.org> References: <20201026235516.1025100-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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 ee802fc3bcdfc..9fa1bc5514f3e 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.25.1