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 91D51146A62 for ; Sat, 17 Aug 2024 09:13:11 +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=1723885991; cv=none; b=pAvwFIFfvaVPC/+nV7CF+E4EU8uELB4l0qQrF1mUXgnJfKfd8D2PuI78YU5eQ99UFxiJK7bLKBE5NHO8TTXBgNEOen1QJL6LzYyvJomrNhRximzJ3boyGxd+fjTrbVxSrTtO2hQllmUyeLqhVXNgxO1MNUCrivkaeR1EPDH2S74= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723885991; c=relaxed/simple; bh=R0vxd9/fJMTMZghyQS1cox3Vl63crMLTuJsUq5xB9bc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=cxx1APpnRSkE9qmsnQMhh7XEeEiqvmbG/yzuD3VOB9Wwpg8o8PPJOXaRKlnMrP1Q4WwSz5S2rnauL10q6xhVtDVRB6MsKuIYUZYmgGLhvV36G6gQqvuh2J3+NXeOBBS6/NCSMJhvMkapOhArdI9BsrMRAeqwPlbL6+yOmTnXyrg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=QsfnWcSw; 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="QsfnWcSw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 111BFC116B1; Sat, 17 Aug 2024 09:13:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1723885991; bh=R0vxd9/fJMTMZghyQS1cox3Vl63crMLTuJsUq5xB9bc=; h=From:To:Cc:Subject:Date:Reply-to:From; b=QsfnWcSw3OXz3b3J6Wv3oYGIGUU8EUo4zwEDZcA1wPMvYR2q7wOgMJERnv7JFobrJ hL7fFZSTjWCslGQKnsWpIEGSZ9AQ5MKj+R31YrlkDWEqpngoiqYF7KE74tTp0I+Pwz +bl+kcrCvV5eptEtzjJmhViES2ORaJccWzCer478= From: Greg Kroah-Hartman To: linux-cve-announce@vger.kernel.org Cc: Greg Kroah-Hartman Subject: CVE-2024-42319: mailbox: mtk-cmdq: Move devm_mbox_controller_register() after devm_pm_runtime_enable() Date: Sat, 17 Aug 2024 11:10:24 +0200 Message-ID: <2024081754-CVE-2024-42319-ec7c@gregkh> X-Mailer: git-send-email 2.46.0 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=2901; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=R0vxd9/fJMTMZghyQS1cox3Vl63crMLTuJsUq5xB9bc=; b=owGbwMvMwCRo6H6F97bub03G02pJDGkHMh7VvFOSm2iyZH61zKS2CzNV9jfVFxRP+6Sw0OZu3 N8VHCsEOmJZGASZGGTFFFm+bOM5ur/ikKKXoe1pmDmsTCBDGLg4BWAiHhMZFpz780nJdVP/izPH ggQmzc5g0eDSncSw4MCe/qlH1jJJ5H28wsfu+eCWt8nF+wA= 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: 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 623a6143a845 and fixed in 6.10.3 with commit 11fa625b45fa Issue introduced in 4.19 with commit 623a6143a845 and fixed in 6.11-rc1 with commit a8bd68e4329f 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/11fa625b45faf0649118b9deaf2d31c86ac41911 https://git.kernel.org/stable/c/a8bd68e4329f9a0ad1b878733e0f80be6a971649