Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp882019pxb; Tue, 3 Nov 2020 15:25:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJzIiJ+HPjHRKCRF1xGIwLTQDLtwuet6UVlCWmuSvboJCgk84CUKDOh8lOea/7vO/KVSwAG2 X-Received: by 2002:a17:906:76d3:: with SMTP id q19mr21110171ejn.162.1604445932125; Tue, 03 Nov 2020 15:25:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604445932; cv=none; d=google.com; s=arc-20160816; b=CaizcIsBY0mG+oI7myMart3VdT7xBT+8keBxZ/+1VhpdMTAqMOZJpVi1z7rFewk/LO qWPg+htx9Z4y4vyOnynAShNcGT02EAeQToCPLb/7Tfxy8IT3CxkyUsGy7XU/SVDDD/lC K/gzBm1WsVRgbTPIL+LvtBnNijoH0XgW36J18R2Fc/f1J9kl7LJljMAxYbozQbiLBA8X drl9K/vlcIHQ5MG37hIDDM1Xf7qA+Ewy0Up4K/ztTZc4hsxnvP5rbHO2ql0fsE8txZIt Wrx9pWb0Y8rpvDEmp7vFk4ctRIV193Ps+XLBNM47M1EDIP4f8+YF60D0YHSxAm0Bz05F 5quQ== 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=L556PfeOyWyh++PBHg8H71sDNBJC6MYQrPYWVS0lh2s=; b=wMmbywru+pLWMjJVxIatnDOj9TJeafeY+8SrNoY+hdl49SBIvJqxtyUjHh4BtOdHUX azE6JJwI0Y76athRtg0JWctpY/ho4Ryrx/BKjJ5CskTL4Dw/+6yOsQa/Nh7SpDmdTo47 plxHCp2fkPlTLIFTX70sz8egSA72e29S6UfhaSxDJTF9Z9B8zzCbI3dKJjUmIo9WBuXr pZrF2tzXtzztp7a0l6A6FHXGiNNABYQ1dPOwK5mdmo1U3Nq0DsuBMRG1zUaXARGF9kd9 Eu2nZpR9HJ55nnlvTd2jZbQxSm4I5TAIDanNSKRSd9+VKEyEFb0sn4kOMK58RvcKbSoc Ls7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YVzcayY7; 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 e10si239987ejl.139.2020.11.03.15.25.09; Tue, 03 Nov 2020 15:25:32 -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=YVzcayY7; 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 S2388552AbgKCVJn (ORCPT + 99 others); Tue, 3 Nov 2020 16:09:43 -0500 Received: from mail.kernel.org ([198.145.29.99]:49850 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388553AbgKCVJl (ORCPT ); Tue, 3 Nov 2020 16:09:41 -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 0FEA0206B5; Tue, 3 Nov 2020 21:09:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604437780; bh=MdjBSPkgsz9paR4rhfpj8KntD4vYei0etpsLlNxD7tw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YVzcayY72Lb2OuCMSHS7mP5h324t0Nwe35lqu2hlulFr9g5ZE+c4rhlcrMHgcJZ5E 9ixGoxAZ+/+ULsXu9eNvaMOX6f3KE45HdlEa02w72ItDGdaYbIYCgysftKGzDc9E9t k0oXSmsApSJu3WWB+8tCpS1Z4ITlr7SJ/a/VUv7M= 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.14 030/125] media: platform: Improve queue set up flow for bug fixing Date: Tue, 3 Nov 2020 21:36:47 +0100 Message-Id: <20201103203201.080789134@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203156.372184213@linuxfoundation.org> References: <20201103203156.372184213@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 46c996936798a..fd9e13500fe7f 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