Lucene search

K
cvelistLinuxCVELIST:CVE-2024-26899
HistoryApr 17, 2024 - 10:27 a.m.

CVE-2024-26899 block: fix deadlock between bd_link_disk_holder and partition scan

2024-04-1710:27:49
Linux
www.cve.org
linux kernel
vulnerability resolved
block devices
deadlock fix
open_mutex
bd_link_disk_holder
partition scan
driver initialization
io hold
raid
local mutex

5.5 Medium

AI Score

Confidence

High

0.0004 Low

EPSS

Percentile

5.1%

In the Linux kernel, the following vulnerability has been resolved:

block: fix deadlock between bd_link_disk_holder and partition scan

‘open_mutex’ of gendisk is used to protect open/close block devices. But
in bd_link_disk_holder(), it is used to protect the creation of symlink
between holding disk and slave bdev, which introduces some issues.

When bd_link_disk_holder() is called, the driver is usually in the process
of initialization/modification and may suspend submitting io. At this
time, any io hold ‘open_mutex’, such as scanning partitions, can cause
deadlocks. For example, in raid:

T1 T2
bdev_open_by_dev
lock open_mutex [1]

efi_partition

md_submit_bio
md_ioctl mddev_syspend
-> suspend all io
md_add_new_disk
bind_rdev_to_array
bd_link_disk_holder
try lock open_mutex [2]
md_handle_request
-> wait mddev_resume

T1 scan partition, T2 add a new device to raid. T1 waits for T2 to resume
mddev, but T2 waits for open_mutex held by T1. Deadlock occurs.

Fix it by introducing a local mutex ‘blk_holder_mutex’ to replace
‘open_mutex’.

CNA Affected

[
  {
    "product": "Linux",
    "vendor": "Linux",
    "defaultStatus": "unaffected",
    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
    "programFiles": [
      "block/holder.c"
    ],
    "versions": [
      {
        "version": "1b0a2d950ee2",
        "lessThan": "1e5c5b0abaee",
        "status": "affected",
        "versionType": "git"
      },
      {
        "version": "1b0a2d950ee2",
        "lessThan": "5a87c1f7993b",
        "status": "affected",
        "versionType": "git"
      },
      {
        "version": "1b0a2d950ee2",
        "lessThan": "03f12122b20b",
        "status": "affected",
        "versionType": "git"
      }
    ]
  },
  {
    "product": "Linux",
    "vendor": "Linux",
    "defaultStatus": "affected",
    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
    "programFiles": [
      "block/holder.c"
    ],
    "versions": [
      {
        "version": "6.7",
        "status": "affected"
      },
      {
        "version": "0",
        "lessThan": "6.7",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "6.7.11",
        "lessThanOrEqual": "6.7.*",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "6.8.2",
        "lessThanOrEqual": "6.8.*",
        "status": "unaffected",
        "versionType": "custom"
      },
      {
        "version": "6.9",
        "lessThanOrEqual": "*",
        "status": "unaffected",
        "versionType": "original_commit_for_fix"
      }
    ]
  }
]

5.5 Medium

AI Score

Confidence

High

0.0004 Low

EPSS

Percentile

5.1%