linux-cve-announce.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* CVE-2021-47195: spi: fix use-after-free of the add_lock mutex
@ 2024-04-10 18:57 Greg Kroah-Hartman
  0 siblings, 0 replies; only message in thread
From: Greg Kroah-Hartman @ 2024-04-10 18:57 UTC (permalink / raw)
  To: linux-cve-announce; +Cc: Greg Kroah-Hartman

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 6098475d4cb4 and fixed in 5.15.5 with commit 37330f37f666
	Issue introduced in 5.15 with commit 6098475d4cb4 and fixed in 5.16 with commit 6c53b45c71b4
	Issue introduced in 5.14.15 with commit 722ef19a161c

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/37330f37f6666c7739a44b2b6b95b047ccdbed2d
	https://git.kernel.org/stable/c/6c53b45c71b4920b5e62f0ea8079a1da382b9434

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-04-10 18:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-10 18:57 CVE-2021-47195: spi: fix use-after-free of the add_lock mutex Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).