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 DD46A2139CD for ; Wed, 19 Jun 2024 13:46:24 +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=1718804786; cv=none; b=jF//hwe5ooH3/vLOhdif71VrxftfoJ+dkTWno6O+OcuoShuzKNEqLHel5C1fcKdrCUPRJKzdDgXYNlTdPZJHfXA/LIE+V3Wu3ycnaEPuNS5YFYEfVo3OUUz0HxywzEgWXbzb/PUZXqyCSinsIW8Zgepmi8QbpG7RvMD0+qfWwnU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718804786; c=relaxed/simple; bh=NdD6mK987PuIlq2WP4EtwpUsDdhy+obnhrKxTe9IuwA=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=tx5CwzDtJMxuB1JffbZBnXOtHMTB4ondf+EZHDdhyuGrvUVTV9GJTC0G6buu2psEpdULVwgdh2PtyxDvyElFToKz7v9CxEoYgn8KK57Hpf3XgiYuUpLFg67BKIAzlSHtJBw9VOsRhMH++20ltPK9Q+UUZVpsgcCG8ex6u24xIBY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=mQug3aKE; 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="mQug3aKE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 321F3C2BBFC; Wed, 19 Jun 2024 13:46:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1718804784; bh=NdD6mK987PuIlq2WP4EtwpUsDdhy+obnhrKxTe9IuwA=; h=From:To:Cc:Subject:Date:Reply-to:From; b=mQug3aKEHo5ANTufEb16tsoviwyKxwhYXxohW74c/XJrdbNNIC2lecVTzgXssS9wI oKI5JyLe769fQy0tHJOLuVmrtKv1DBuPWd2aN7QaAeUFJElaEsO63rXHvaCTWUSCcA g/WmPW9OEzSSL9scVDTnWZa3GXdovxdxpUAmM4fc= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-38592: drm/mediatek: Init `ddp_comp` with devm_kcalloc() Date: Wed, 19 Jun 2024 15:45:58 +0200 Message-ID: <2024061955-CVE-2024-38592-5b29@gregkh> X-Mailer: git-send-email 2.45.2 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=2837; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=NdD6mK987PuIlq2WP4EtwpUsDdhy+obnhrKxTe9IuwA=; b=owGbwMvMwCRo6H6F97bub03G02pJDGlFD4XPXrJYGjujpTs4cLF027kby5kmqtzUlf587177W wcTqbLLHbEsDIJMDLJiiixftvEc3V9xSNHL0PY0zBxWJpAhDFycAjCRFnGGedbe4c/b2oUmLuBT OeUjskdHed4OHoYFJ6e52btNTW0Iznj9SP9PY3DRw0/yAA== 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: drm/mediatek: Init `ddp_comp` with devm_kcalloc() In the case where `conn_routes` is true we allocate an extra slot in the `ddp_comp` array but mtk_drm_crtc_create() never seemed to initialize it in the test case I ran. For me, this caused a later crash when we looped through the array in mtk_drm_crtc_mode_valid(). This showed up for me when I booted with `slub_debug=FZPUA` which poisons the memory initially. Without `slub_debug` I couldn't reproduce, presumably because the later code handles the value being NULL and in most cases (not guaranteed in all cases) the memory the allocator returned started out as 0. It really doesn't hurt to initialize the array with devm_kcalloc() since the array is small and the overhead of initting a handful of elements to 0 is small. In general initting memory to zero is a safer practice and usually it's suggested to only use the non-initting alloc functions if you really need to. Let's switch the function to use an allocation function that zeros the memory. For me, this avoids the crash. The Linux kernel CVE team has assigned CVE-2024-38592 to this issue. Affected and fixed versions =========================== Issue introduced in 6.7 with commit 01389b324c97 and fixed in 6.8.12 with commit cf69d0af7db9 Issue introduced in 6.7 with commit 01389b324c97 and fixed in 6.9.3 with commit 9fe2cc3fa44f Issue introduced in 6.7 with commit 01389b324c97 and fixed in 6.10-rc1 with commit 01a2c5123e27 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-38592 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/gpu/drm/mediatek/mtk_drm_crtc.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/cf69d0af7db917b82aceaa44b7b1b9376609da22 https://git.kernel.org/stable/c/9fe2cc3fa44f7ad7ba5f29c1a68b2b924c17b9b1 https://git.kernel.org/stable/c/01a2c5123e27b3c4685bf2fc4c2e879f6e0c7b33