Received: by 2002:a05:6622:f08:0:0:0:0 with SMTP id l8csp4479813ivc; Tue, 3 Nov 2020 13:07:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJzmtiUWWpIkfXszXrziKuytehjSJ3uSyPEsruf+N3w4eyBLojVOzbWf0vWdYnoW0dtV88fs X-Received: by 2002:a17:906:9458:: with SMTP id z24mr13907437ejx.318.1604437646521; Tue, 03 Nov 2020 13:07:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604437646; cv=none; d=google.com; s=arc-20160816; b=svOEB/xK5X6tg3c6LX33zmsi/skDF4jqnLdKlntAaPJK2ewTTdnxCZ1bcJVTY1OGs3 sSfB8n1TTQ6Bzr4Miy9iMjsTQ57sg6JfYoBtY3KDdBHUM2CkiC6T6+wKgSRodfL1LfPy EI95kYi+JvfQJN60MuUWy7IRw5SJYf/rJOeiJ9976gKq22BEtv6RocZYtn7nAlTOpSWG m4VTEjuRsc4OHC/t+/dixQzD+tAWxMpZlZX3Z8DJkyPOSwrccGSbo5gsy4Ka/1zBFJKl GpQJz8nluZA8+ykNE/Wv0cGMRjAiE/ywKG91U/XUPzTxINVXDq910tiN5Hh32Xd3AQyo JMnQ== 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=ofAeeKL1psUplzGJi6QMFE8X8yj7aCFmyld46IdkZ8I=; b=lTC+wzJopF5GfTLqGI39xqj3km0u7qpC2kf+o+MIDvDse74QHyS77G2Zq9OF3R0368 VXt4BQxLCMqwBBVbv1M0KIETdk/qKytnAIOrFAiUs5E13hNbrV+LKtFXI+MIGEVkAwvD zfUbhthnuDIehdf4WwM2+Dxev2k+oechK62el27sFnG+dw775d25YjTMU6uIKxPRQKnQ g7H1Lo5wIDemWMYA5YilY4+zrD3sLGby4FqmTaDnonjuvKbuzQQBGohu/5TvYHDMjXBQ zWUia8W3LH5A3gV89BKOOmJnBiVs4NimAyplepiYmauYepifc7LPsY6aWkc6T/fri0CB iFQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tyeMapxv; 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 k22si14668969edr.463.2020.11.03.13.07.03; Tue, 03 Nov 2020 13:07:26 -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=tyeMapxv; 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 S2387894AbgKCVDv (ORCPT + 99 others); Tue, 3 Nov 2020 16:03:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:41452 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730715AbgKCVDn (ORCPT ); Tue, 3 Nov 2020 16:03:43 -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 162C5206B5; Tue, 3 Nov 2020 21:03:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604437423; bh=138KXQYUEbfk6Op72o2MbJmDHJatM+OCR/VJD5SkhBk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tyeMapxvwPaG49qfYuMeji8HtqWEGP/BhU62iXCencbIUmw5oyp8VB+7vwf6qP1cC S0r3g+EwVjMhNvoqTdeEV7qcbLHo2OBwOZQYc2by68N7dnrSvau/tFM2KZ8RG14ck4 bjGUhUdRlhQF06J+Xvx8j5Bru0tt2I3R1rCR8jBA= 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 4.19 070/191] media: platform: Improve queue set up flow for bug fixing Date: Tue, 3 Nov 2020 21:36:02 +0100 Message-Id: <20201103203241.023607544@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203232.656475008@linuxfoundation.org> References: <20201103203232.656475008@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 11429633b2fbc..f0bca30a0a805 100644 --- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c +++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c @@ -579,6 +579,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