| 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-2021-47195: spi: fix use-after-free of the add_lock mutex |
| |
| Description |
| =========== |
| |
| In the Linux kernel, the following vulnerability has been resolved: |
| |
| spi: fix use-after-free of the add_lock mutex |
| |
| Commit 6098475d4cb4 ("spi: Fix deadlock when adding SPI controllers on |
| SPI buses") introduced a per-controller mutex. But mutex_unlock() of |
| said lock is called after the controller is already freed: |
| |
| spi_unregister_controller(ctlr) |
| -> put_device(&ctlr->dev) |
| -> spi_controller_release(dev) |
| -> mutex_unlock(&ctrl->add_lock) |
| |
| Move the put_device() after the mutex_unlock(). |
| |
| The Linux kernel CVE team has assigned CVE-2021-47195 to this issue. |
| |
| |
| Affected and fixed versions |
| =========================== |
| |
| Issue introduced in 5.15 with commit 6098475d4cb48d821bdf453c61118c56e26294f0 and fixed in 5.15.5 with commit 37330f37f6666c7739a44b2b6b95b047ccdbed2d |
| Issue introduced in 5.15 with commit 6098475d4cb48d821bdf453c61118c56e26294f0 and fixed in 5.16 with commit 6c53b45c71b4920b5e62f0ea8079a1da382b9434 |
| Issue introduced in 5.14.15 with commit 722ef19a161ce3fffb3d1b01ce2301c306639bdd |
| |
| 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-2021-47195 |
| 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/spi/spi.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/54c2c96eafcfd242e52e932ab54ace4784efe1dd |
| https://git.kernel.org/stable/c/11eab327a2a8bd36c38afbff920ae1bd45588dd4 |
| https://git.kernel.org/stable/c/37330f37f6666c7739a44b2b6b95b047ccdbed2d |
| https://git.kernel.org/stable/c/6c53b45c71b4920b5e62f0ea8079a1da382b9434 |