| From bippy-5f407fcff5a0 Mon Sep 17 00:00:00 2001 |
| From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
| To: <linux-cve-announce@vger.kernel.org> |
| Reply-to: <cve@kernel.org>, <linux-kernel@vger.kernel.org> |
| Subject: CVE-2024-42319: mailbox: mtk-cmdq: Move devm_mbox_controller_register() after devm_pm_runtime_enable() |
| |
| Description |
| =========== |
| |
| In the Linux kernel, the following vulnerability has been resolved: |
| |
| mailbox: mtk-cmdq: Move devm_mbox_controller_register() after devm_pm_runtime_enable() |
| |
| When mtk-cmdq unbinds, a WARN_ON message with condition |
| pm_runtime_get_sync() < 0 occurs. |
| |
| According to the call tracei below: |
| cmdq_mbox_shutdown |
| mbox_free_channel |
| mbox_controller_unregister |
| __devm_mbox_controller_unregister |
| ... |
| |
| The root cause can be deduced to be calling pm_runtime_get_sync() after |
| calling pm_runtime_disable() as observed below: |
| 1. CMDQ driver uses devm_mbox_controller_register() in cmdq_probe() |
| to bind the cmdq device to the mbox_controller, so |
| devm_mbox_controller_unregister() will automatically unregister |
| the device bound to the mailbox controller when the device-managed |
| resource is removed. That means devm_mbox_controller_unregister() |
| and cmdq_mbox_shoutdown() will be called after cmdq_remove(). |
| 2. CMDQ driver also uses devm_pm_runtime_enable() in cmdq_probe() after |
| devm_mbox_controller_register(), so that devm_pm_runtime_disable() |
| will be called after cmdq_remove(), but before |
| devm_mbox_controller_unregister(). |
| |
| To fix this problem, cmdq_probe() needs to move |
| devm_mbox_controller_register() after devm_pm_runtime_enable() to make |
| devm_pm_runtime_disable() be called after |
| devm_mbox_controller_unregister(). |
| |
| The Linux kernel CVE team has assigned CVE-2024-42319 to this issue. |
| |
| |
| Affected and fixed versions |
| =========================== |
| |
| Issue introduced in 4.19 with commit 623a6143a845bd485b00ba684f0ccef11835edab and fixed in 6.1.120 with commit 1403991a40b94438a2acc749bf05c117abdb34f9 |
| Issue introduced in 4.19 with commit 623a6143a845bd485b00ba684f0ccef11835edab and fixed in 6.6.64 with commit d00df6700ad10974a7e20646956f4ff22cdbe0ec |
| Issue introduced in 4.19 with commit 623a6143a845bd485b00ba684f0ccef11835edab and fixed in 6.10.3 with commit 11fa625b45faf0649118b9deaf2d31c86ac41911 |
| Issue introduced in 4.19 with commit 623a6143a845bd485b00ba684f0ccef11835edab and fixed in 6.11 with commit a8bd68e4329f9a0ad1b878733e0f80be6a971649 |
| |
| 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-42319 |
| 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/mailbox/mtk-cmdq-mailbox.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/1403991a40b94438a2acc749bf05c117abdb34f9 |
| https://git.kernel.org/stable/c/d00df6700ad10974a7e20646956f4ff22cdbe0ec |
| https://git.kernel.org/stable/c/11fa625b45faf0649118b9deaf2d31c86ac41911 |
| https://git.kernel.org/stable/c/a8bd68e4329f9a0ad1b878733e0f80be6a971649 |