Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2134513lqb; Mon, 27 May 2024 08:56:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWjmfqMXhhFl53AUK4YdcApla2InmAmou2WBZBmFXi0G1ZI34VmessKXG6oS1/Fwq3QTxFrGJ31HShjPtoQ0wIFRSC8v9edij+aY5dYNQ== X-Google-Smtp-Source: AGHT+IGWk7zEdk7MJVa2XjN+KNJ9JXrT16ERyo7imrehSNQiYzhVwR0ERfx1ZdGr+6p7km4X+fP1 X-Received: by 2002:a05:6214:458c:b0:6ad:7e81:8f11 with SMTP id 6a1803df08f44-6ad7e8197d3mr46066856d6.65.1716825380276; Mon, 27 May 2024 08:56:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716825380; cv=pass; d=google.com; s=arc-20160816; b=PV9H8L4NXask5K96WFFT6HjrqRYdkwiaPg9AUblcEscGRIBrGz3SQDlEgZDqu55xQo QIRoRzQl2ZT74cHDypEQMJsEbYHBTL3K1EkHwEckBaLS60SlTiDmLv1e3EYED7m2fdWh /FFe0V0NWlFycSDxATnFbC8AoIqUedlaLadkecYJxfdsZ+B+evvEMVhkGLexJ1Xo/nc0 K3X2v7WV2MvbRFavuYCEo3tGLPa96WSU2oArquJanDQ1kUx06u6HT4ru2jXN5w58A9Ai B6H19NjctoJp4hRb6E/XZ3OUgNIQAfLA/tVkhSKcEPFd8WpqiMhdcfnoJVTt3tIrXxZL 4R/g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=iC4pMqfb4hzCsC4mrtoheBzzCX+jebiTXeYB+FxV4WM=; fh=76XlK1KSa0w5KECKjhmia/qcNAMi4RZ2z3EKNg4MOR8=; b=JIXoMzjjx6FDBos+wrwa2/7kXMLAlc9/QGOYVDgEXN1Q7rtu3jQsQ9o2N5LgUibWxG uDQwc6XHAFD11zu+/j2mLdeEihZ9+pmsq3AU3q7z2XImsBzObnEaKb0dR4IwT2phpArC 3ZeYuWcB2ndL6KyrzW2w3lYfTV2E3sGbTOJ8R7Xv91ZLPzBTe9hyOzokzGnLz+gGLqcd ryBGd6ee4yQu9J9rNaRqWsyfM9mXpFNVsYCBSVrHjDUn7YI5uNN4IAIDCPWztHEGhJuT pM/ctgJrjC7EyQxFpdrSYW4viR8k1Oe7Uh1t8wspi8Jpz0wXZ5brDl5QjU8F+35uGViJ TOOg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XvtvWAsA; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-191120-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191120-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6ac070f1437si82753186d6.216.2024.05.27.08.56.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 08:56:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-191120-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XvtvWAsA; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-191120-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191120-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id EFFE71C21752 for ; Mon, 27 May 2024 15:56:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6705C1667C7; Mon, 27 May 2024 15:52:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XvtvWAsA" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 87E7815A84F; Mon, 27 May 2024 15:52:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716825176; cv=none; b=SFfBuAfT3ABjw9Z3P6pH/0kaIR8BqT6dHjYBbG+pSM0XMLgDxwZ2Kg3On4rJ1Rm/kFUw7fxiISVKj6LDA91hebWwPBBDwOz9lbGVdEboBMToZBDsxdJ781sAxhFwAlGRcDiphlJjqERgJWkt0RHvBp8YOzw7j6qFyaVdzcYhWgw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716825176; c=relaxed/simple; bh=ublOx72acyNOeeVaCWRsyHmqdVfgbtXS0a5Hkh7LaXQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pJzs9Uk1HdkAVnq6I5SWVnFoada05suHPiyY+1CP6PRWSQO9vTMflzWENy3FLrO5efv8V/PHHC/jcFCDuETWIPxzA5CYYPj27D0Y3RXJ6lcQC7WDU6tiowqFI3Z+jRA7wrm6oSA4YZLYIvRol71FxJwbnh52W7TECux9veV8CLw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XvtvWAsA; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B00EEC2BBFC; Mon, 27 May 2024 15:52:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716825176; bh=ublOx72acyNOeeVaCWRsyHmqdVfgbtXS0a5Hkh7LaXQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XvtvWAsAu7Htom0xdcQVR8q3NVLpL1WbXUNSiEfjmSgWgRQ+0qltD6J058p4VZMnj dufe7Ogf0KbX68VO2mvJriHWUJxO+ubhZfv6Lgv0ZL5Nzx6dpWUZylFXBVGe9xjWz/ La1Km13UILNYnfdRZhhIG7w2jGuYPo/5J75PJB3WJTFGbl5wYkQLJqXusZM1dXXOnS oCcZlBOrGqVBdg2894e7jRmG8YYUruirXGXXX3OYAr7FXFXdqlBq6hW4+Tyeo67tx1 yXti2NxfbbDFv43zE/RXHsXDM1RlVZAAo8Wnh9A7ozwEjiD/VkKY+YJa7x08jrAQs4 9vR/zMrvJCscA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Fullway Wang , Mauro Carvalho Chehab , Sasha Levin , tiffany.lin@mediatek.com, andrew-ct.chen@mediatek.com, yunfei.dong@mediatek.com, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, hverkuil-cisco@xs4all.nl, nicolas.dufresne@collabora.com, colin.i.king@gmail.com, linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH AUTOSEL 6.9 21/23] media: mtk-vcodec: potential null pointer deference in SCP Date: Mon, 27 May 2024 11:50:22 -0400 Message-ID: <20240527155123.3863983-21-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240527155123.3863983-1-sashal@kernel.org> References: <20240527155123.3863983-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.9.2 Content-Transfer-Encoding: 8bit From: Fullway Wang [ Upstream commit 53dbe08504442dc7ba4865c09b3bbf5fe849681b ] The return value of devm_kzalloc() needs to be checked to avoid NULL pointer deference. This is similar to CVE-2022-3113. Link: https://lore.kernel.org/linux-media/PH7PR20MB5925094DAE3FD750C7E39E01BF712@PH7PR20MB5925.namprd20.prod.outlook.com Signed-off-by: Fullway Wang Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- .../media/platform/mediatek/vcodec/common/mtk_vcodec_fw_scp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_scp.c b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_scp.c index 6bbe55de6ce9a..ff23b225db705 100644 --- a/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_scp.c +++ b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_fw_scp.c @@ -79,6 +79,8 @@ struct mtk_vcodec_fw *mtk_vcodec_fw_scp_init(void *priv, enum mtk_vcodec_fw_use } fw = devm_kzalloc(&plat_dev->dev, sizeof(*fw), GFP_KERNEL); + if (!fw) + return ERR_PTR(-ENOMEM); fw->type = SCP; fw->ops = &mtk_vcodec_rproc_msg; fw->scp = scp; -- 2.43.0