Lucene search

K
vulnrichmentLinuxVULNRICHMENT:CVE-2021-47195
HistoryApr 10, 2024 - 6:56 p.m.

CVE-2021-47195 spi: fix use-after-free of the add_lock mutex

2024-04-1018:56:31
Linux
github.com
6
linux kernel
vulnerability
fix
spi
use-after-free
mutex

AI Score

6.8

Confidence

Low

EPSS

0

Percentile

9.0%

SSVC

Exploitation

none

Automatable

no

Technical Impact

partial

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().

CNA Affected

[
  {
    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
    "vendor": "Linux",
    "product": "Linux",
    "versions": [
      {
        "status": "affected",
        "version": "6098475d4cb4",
        "lessThan": "37330f37f666",
        "versionType": "git"
      },
      {
        "status": "affected",
        "version": "6098475d4cb4",
        "lessThan": "6c53b45c71b4",
        "versionType": "git"
      }
    ],
    "programFiles": [
      "drivers/spi/spi.c"
    ],
    "defaultStatus": "unaffected"
  },
  {
    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
    "vendor": "Linux",
    "product": "Linux",
    "versions": [
      {
        "status": "affected",
        "version": "5.15"
      },
      {
        "status": "unaffected",
        "version": "0",
        "lessThan": "5.15",
        "versionType": "custom"
      },
      {
        "status": "unaffected",
        "version": "5.15.5",
        "versionType": "custom",
        "lessThanOrEqual": "5.15.*"
      },
      {
        "status": "unaffected",
        "version": "5.16",
        "versionType": "original_commit_for_fix",
        "lessThanOrEqual": "*"
      }
    ],
    "programFiles": [
      "drivers/spi/spi.c"
    ],
    "defaultStatus": "affected"
  }
]

AI Score

6.8

Confidence

Low

EPSS

0

Percentile

9.0%

SSVC

Exploitation

none

Automatable

no

Technical Impact

partial