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 70BD11DDCE for ; Sun, 19 May 2024 10:12:21 +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=1716113541; cv=none; b=E1dOKS43X4ofW5SlmSPGJDhFKOBir2kgawCmK23b0W2NHMoW3zBCnLp3MWyFsWwyE9+pb75K/xrd0yqItzlIUmAdaY2tKlIQKWf/9EOTmjpmm/MH405QLI1UITgIGKsm4UzLxhwC/1YApxkNL3X92Ewi7Sb7EsX/ikNFCHQiMSg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716113541; c=relaxed/simple; bh=aFVvgwP+7mXlTlDysoKQCDX4AIqhvzfitlz6BSZpbKo=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=lxwk6Hzfin1LbQ8FW4xJcgdpWxpYdMSR19QGXPyW5zgD6/e3LiYsCsUvbZHuC6xnemQKpR2aqhH5Jmjvqq5yQ5GqS+7UE/oEJaFxYLm4k5J0VYzJwXt8PhZQeCzUzbB86Lm9HSeU4EqUdyYpwJyuB7r951wIRvIHonPgcPp/BVo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=K5DXFt4J; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="K5DXFt4J" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B20F6C32781; Sun, 19 May 2024 10:12:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1716113541; bh=aFVvgwP+7mXlTlDysoKQCDX4AIqhvzfitlz6BSZpbKo=; h=From:To:Cc:Subject:Date:Reply-to:From; b=K5DXFt4JO8xjC4Mj4PFVokdRkx6VoaU7FgJG0xXvOf1c1cGijEvDqRzsQhBI6x4ne gMSLwiVZ1SI4ke3g9ccAJGGXeX2or88I8LcuxoYW9hwShE39b81KeuMZvVcZpVAXNZ EX28PP1yr3vFw/6zP2P9dESnSb6taKUozEgd7Ey8= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-35921: media: mediatek: vcodec: Fix oops when HEVC init fails Date: Sun, 19 May 2024 12:11:15 +0200 Message-ID: <2024051913-CVE-2024-35921-ec49@gregkh> X-Mailer: git-send-email 2.45.1 Precedence: bulk X-Mailing-List: linux-cve-announce@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reply-to: , X-Developer-Signature: v=1; a=openpgp-sha256; l=3813; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=aFVvgwP+7mXlTlDysoKQCDX4AIqhvzfitlz6BSZpbKo=; b=owGbwMvMwCRo6H6F97bub03G02pJDGmeFxyffxOSDBdieje55fAHVqW58qGZR1RkDggHqV7QY jSUsc7uiGVhEGRikBVTZPmyjefo/opDil6Gtqdh5rAygQxh4OIUgInwFTEs2Hlho0BY019mXw1+ Jh2Vbq6yqcfOMixYxDM3oNSoe5uyiOdaUYf2rTs3cXADAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit Description =========== In the Linux kernel, the following vulnerability has been resolved: media: mediatek: vcodec: Fix oops when HEVC init fails The stateless HEVC decoder saves the instance pointer in the context regardless if the initialization worked or not. This caused a use after free, when the pointer is freed in case of a failure in the deinit function. Only store the instance pointer when the initialization was successful, to solve this issue. Hardware name: Acer Tomato (rev3 - 4) board (DT) pstate: 80400009 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : vcodec_vpu_send_msg+0x4c/0x190 [mtk_vcodec_dec] lr : vcodec_send_ap_ipi+0x78/0x170 [mtk_vcodec_dec] sp : ffff80008750bc20 x29: ffff80008750bc20 x28: ffff1299f6d70000 x27: 0000000000000000 x26: 0000000000000000 x25: 0000000000000000 x24: 0000000000000000 x23: ffff80008750bc98 x22: 000000000000a003 x21: ffffd45c4cfae000 x20: 0000000000000010 x19: ffff1299fd668310 x18: 000000000000001a x17: 000000040044ffff x16: ffffd45cb15dc648 x15: 0000000000000000 x14: ffff1299c08da1c0 x13: ffffd45cb1f87a10 x12: ffffd45cb2f5fe80 x11: 0000000000000001 x10: 0000000000001b30 x9 : ffffd45c4d12b488 x8 : 1fffe25339380d81 x7 : 0000000000000001 x6 : ffff1299c9c06c00 x5 : 0000000000000132 x4 : 0000000000000000 x3 : 0000000000000000 x2 : 0000000000000010 x1 : ffff80008750bc98 x0 : 0000000000000000 Call trace: vcodec_vpu_send_msg+0x4c/0x190 [mtk_vcodec_dec] vcodec_send_ap_ipi+0x78/0x170 [mtk_vcodec_dec] vpu_dec_deinit+0x1c/0x30 [mtk_vcodec_dec] vdec_hevc_slice_deinit+0x30/0x98 [mtk_vcodec_dec] vdec_if_deinit+0x38/0x68 [mtk_vcodec_dec] mtk_vcodec_dec_release+0x20/0x40 [mtk_vcodec_dec] fops_vcodec_release+0x64/0x118 [mtk_vcodec_dec] v4l2_release+0x7c/0x100 __fput+0x80/0x2d8 __fput_sync+0x58/0x70 __arm64_sys_close+0x40/0x90 invoke_syscall+0x50/0x128 el0_svc_common.constprop.0+0x48/0xf0 do_el0_svc+0x24/0x38 el0_svc+0x38/0xd8 el0t_64_sync_handler+0xc0/0xc8 el0t_64_sync+0x1a8/0x1b0 Code: d503201f f9401660 b900127f b900227f (f9400400) The Linux kernel CVE team has assigned CVE-2024-35921 to this issue. Affected and fixed versions =========================== Issue introduced in 6.5 with commit 2674486aac7d and fixed in 6.6.27 with commit ec25fc3c2c1e Issue introduced in 6.5 with commit 2674486aac7d and fixed in 6.8.6 with commit 521ce0ea7418 Issue introduced in 6.5 with commit 2674486aac7d and fixed in 6.9 with commit 97c75ee5de06 Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community. Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at https://cve.org/CVERecord/?id=CVE-2024-35921 will be updated if fixes are backported, please check that for the most up to date information about this issue. Affected files ============== The file(s) affected by this issue are: drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_hevc_req_multi_if.c Mitigation ========== The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits: https://git.kernel.org/stable/c/ec25fc3c2c1e8958a51abcfed614f81446d918c4 https://git.kernel.org/stable/c/521ce0ea7418298d754494fe53263c23c4c78a8e https://git.kernel.org/stable/c/97c75ee5de060d271d80109b0c47cb6008439e5b