From mboxrd@z Thu Jan 1 00:00:00 1970 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 74470216E23 for ; Wed, 26 Feb 2025 02:14:22 +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=1740536062; cv=none; b=YEPe193liK77wohRvrneOrOF59jey6/mdgs8fkVQn5n2lq0iXSbPr/1uu3lXbVFnnuxpqyb+o2exRuYjLJ/KCarMo99sR9jPAYp6ay5K8/Y4wBH5hWWQrI9DvtdrfWvCE+wQXQU90UCxZs/gMPBim+52mhoWzbpQ/kLx159sDZg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740536062; c=relaxed/simple; bh=k84lgdmcz71IDk1qln//5Btg/CtrXDdibpAsH2EJhJk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=smETzxQcgDWNb3PPRAxZuX4EjzJBR5+tPA8qKWYUOuQYP3SXz2Q1YIgKAH1gBSxy2fxaVVMfVYusNq4Mlxa6rX0otxcsr0jSdbXxlcjddXPS1rJR9w/pWE1EivsTKuHvaNCwLFzd8/8IphaoxbuZkoxXe4kPWfuc+66Qc+/OZe0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=y6IairIC; 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="y6IairIC" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4835FC4CEDD; Wed, 26 Feb 2025 02:14:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1740536062; bh=k84lgdmcz71IDk1qln//5Btg/CtrXDdibpAsH2EJhJk=; h=From:To:Cc:Subject:Date:Reply-to:From; b=y6IairICNEVYjzvLVq2lUZxpOXT+cf+vQq1EYyA9o+Bwg4NyuO/7SzxpNwTwESaFl iUpu48IHR+fkroDsr/Zm4DSwRZedi+mQG+vxElNNXqBHc3ZrUgvOBsB3zMnOo/8xl0 igUhxfXHBWeMkSv7fcra77znNULKbQ7Zc8IZHCZY= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2022-49424: iommu/mediatek: Fix NULL pointer dereference when printing dev_name Date: Wed, 26 Feb 2025 03:11:38 +0100 Message-ID: <2025022654-CVE-2022-49424-23ec@gregkh> X-Mailer: git-send-email 2.48.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=5022; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=k84lgdmcz71IDk1qln//5Btg/CtrXDdibpAsH2EJhJk=; b=owGbwMvMwCRo6H6F97bub03G02pJDOn7yj+f+nOuxOCF0d8l8U//yrmVyXW4qduv3LNzr/ODP 6u6AptjO2JZGASZGGTFFFm+bOM5ur/ikKKXoe1pmDmsTCBDGLg4BWAiDRwM8zOuXll8aMnc1KdV f9muyOs8e1Se9JFhvq9l3arTXIJpc0JefH38b0HtNcOD9gA= 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: iommu/mediatek: Fix NULL pointer dereference when printing dev_name When larbdev is NULL (in the case I hit, the node is incorrectly set iommus = <&iommu NUM>), it will cause device_link_add() fail and kernel crashes when we try to print dev_name(larbdev). Let's fail the probe if a larbdev is NULL to avoid invalid inputs from dts. It should work for normal correct setting and avoid the crash caused by my incorrect setting. Error log: [ 18.189042][ T301] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000050 ... [ 18.344519][ T301] pstate: a0400005 (NzCv daif +PAN -UAO) [ 18.345213][ T301] pc : mtk_iommu_probe_device+0xf8/0x118 [mtk_iommu] [ 18.346050][ T301] lr : mtk_iommu_probe_device+0xd0/0x118 [mtk_iommu] [ 18.346884][ T301] sp : ffffffc00a5635e0 [ 18.347392][ T301] x29: ffffffc00a5635e0 x28: ffffffd44a46c1d8 [ 18.348156][ T301] x27: ffffff80c39a8000 x26: ffffffd44a80cc38 [ 18.348917][ T301] x25: 0000000000000000 x24: ffffffd44a80cc38 [ 18.349677][ T301] x23: ffffffd44e4da4c6 x22: ffffffd44a80cc38 [ 18.350438][ T301] x21: ffffff80cecd1880 x20: 0000000000000000 [ 18.351198][ T301] x19: ffffff80c439f010 x18: ffffffc00a50d0c0 [ 18.351959][ T301] x17: ffffffffffffffff x16: 0000000000000004 [ 18.352719][ T301] x15: 0000000000000004 x14: ffffffd44eb5d420 [ 18.353480][ T301] x13: 0000000000000ad2 x12: 0000000000000003 [ 18.354241][ T301] x11: 00000000fffffad2 x10: c0000000fffffad2 [ 18.355003][ T301] x9 : a0d288d8d7142d00 x8 : a0d288d8d7142d00 [ 18.355763][ T301] x7 : ffffffd44c2bc640 x6 : 0000000000000000 [ 18.356524][ T301] x5 : 0000000000000080 x4 : 0000000000000001 [ 18.357284][ T301] x3 : 0000000000000000 x2 : 0000000000000005 [ 18.358045][ T301] x1 : 0000000000000000 x0 : 0000000000000000 [ 18.360208][ T301] Hardware name: MT6873 (DT) [ 18.360771][ T301] Call trace: [ 18.361168][ T301] dump_backtrace+0xf8/0x1f0 [ 18.361737][ T301] dump_stack_lvl+0xa8/0x11c [ 18.362305][ T301] dump_stack+0x1c/0x2c [ 18.362816][ T301] mrdump_common_die+0x184/0x40c [mrdump] [ 18.363575][ T301] ipanic_die+0x24/0x38 [mrdump] [ 18.364230][ T301] atomic_notifier_call_chain+0x128/0x2b8 [ 18.364937][ T301] die+0x16c/0x568 [ 18.365394][ T301] __do_kernel_fault+0x1e8/0x214 [ 18.365402][ T301] do_page_fault+0xb8/0x678 [ 18.366934][ T301] do_translation_fault+0x48/0x64 [ 18.368645][ T301] do_mem_abort+0x68/0x148 [ 18.368652][ T301] el1_abort+0x40/0x64 [ 18.368660][ T301] el1h_64_sync_handler+0x54/0x88 [ 18.368668][ T301] el1h_64_sync+0x68/0x6c [ 18.368673][ T301] mtk_iommu_probe_device+0xf8/0x118 [mtk_iommu] ... The Linux kernel CVE team has assigned CVE-2022-49424 to this issue. Affected and fixed versions =========================== Issue introduced in 5.15.33 with commit 77fbe028d5a3f7fc6060c4454ead9510533acd1e and fixed in 5.15.46 with commit c3c2734e28d7fac50228c4d2b8896e8695adf304 Issue introduced in 5.17.2 with commit 18ea450ed1b60c1bb336f5efe874f61909ce7bec and fixed in 5.17.14 with commit e9c63c0f73a1bbfd02624f5eae7e881df8b6830f Issue introduced in 5.18 with commit 635319a4a7444ca97124d781cd96deb277ff4d40 and fixed in 5.18.3 with commit 8837c2682b9b2eed83e6212bcf79850c593a6fee Issue introduced in 5.18 with commit 635319a4a7444ca97124d781cd96deb277ff4d40 and fixed in 5.19 with commit de78657e16f41417da9332f09c2d67d100096939 Issue introduced in 5.16.19 with commit b7bf68272b6ae7c469854e2e054db1db1d158999 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-2022-49424 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/iommu/mtk_iommu.c drivers/iommu/mtk_iommu_v1.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/c3c2734e28d7fac50228c4d2b8896e8695adf304 https://git.kernel.org/stable/c/e9c63c0f73a1bbfd02624f5eae7e881df8b6830f https://git.kernel.org/stable/c/8837c2682b9b2eed83e6212bcf79850c593a6fee https://git.kernel.org/stable/c/de78657e16f41417da9332f09c2d67d100096939