CVE-2024-35979: raid1: fix use-after-free for original bio in raid1_write_request()
In the Linux kernel, the following vulnerability has been resolved:
raid1: fix use-after-free for original bio in raid1_write_request()
r1_bio->bios[] is used to record new bios that will be issued to
underlying disks, however, in raid1_write_request(), r1_bio->bios[]
will set to the original bio temporarily. Meanwhile, if blocked rdev
is set, free_r1bio() will be called causing that all r1_bio->bios[]
to be freed:
raid1_write_request()
r1_bio = alloc_r1bio(mddev, bio); -> r1_bio->bios[] is NULL
for (i = 0; i < disks; i++) -> for each rdev in conf
// first rdev is normal
r1_bio->bios[0] = bio; -> set to original bio
// second rdev is blocked
if (test_bit(Blocked, &rdev->flags))
break
if (blocked_rdev)
free_r1bio()
put_all_bios()
bio_put(r1_bio->bios[0]) -> original bio is freed
Test scripts:
mdadm -CR /dev/md0 -l1 -n4 /dev/sd[abcd] --assume-clean
fio -filename=/dev/md0 -ioengine=libaio -rw=write -bs=4k -numjobs=1 \
-iodepth=128 -name=test -direct=1
echo blocked > /sys/block/md0/md/rd2/state
Test result:
BUG bio-264 (Not tainted): Object already free
-----------------------------------------------------------------------------
Allocated in mempool_alloc_slab+0x24/0x50 age=1 cpu=1 pid=869
kmem_cache_alloc+0x324/0x480
mempool_alloc_slab+0x24/0x50
mempool_alloc+0x6e/0x220
bio_alloc_bioset+0x1af/0x4d0
blkdev_direct_IO+0x164/0x8a0
blkdev_write_iter+0x309/0x440
aio_write+0x139/0x2f0
io_submit_one+0x5ca/0xb70
__do_sys_io_submit+0x86/0x270
__x64_sys_io_submit+0x22/0x30
do_syscall_64+0xb1/0x210
entry_SYSCALL_64_after_hwframe+0x6c/0x74
Freed in mempool_free_slab+0x1f/0x30 age=1 cpu=1 pid=869
kmem_cache_free+0x28c/0x550
mempool_free_slab+0x1f/0x30
mempool_free+0x40/0x100
bio_free+0x59/0x80
bio_put+0xf0/0x220
free_r1bio+0x74/0xb0
raid1_make_request+0xadf/0x1150
md_handle_request+0xc7/0x3b0
md_submit_bio+0x76/0x130
__submit_bio+0xd8/0x1d0
submit_bio_noacct_nocheck+0x1eb/0x5c0
submit_bio_noacct+0x169/0xd40
submit_bio+0xee/0x1d0
blkdev_direct_IO+0x322/0x8a0
blkdev_write_iter+0x309/0x440
aio_write+0x139/0x2f0
Since that bios for underlying disks are not allocated yet, fix this
problem by using mempool_free() directly to free the r1_bio.
Security readout for executives and security teams
Plain-English summary
A Linux kernel RAID1 write-path flaw can free an I/O object while it is still in use when a RAID member is blocked. This can corrupt kernel memory or crash affected systems. Exploitation requires local, low-privileged access and the specific RAID1 condition; it is not remotely exploitable according to the supplied CVSS vector.
Executive priority
Treat as a high-priority infrastructure patch for affected RAID1 systems, especially multi-user hosts and platforms running untrusted workloads. It is less urgent for systems without software RAID1 or without local exposure. Schedule remediation through normal emergency kernel maintenance rather than treating it as an internet-wide active exploitation event.
Technical view
In raid1_write_request(), r1_bio->bios[] temporarily references the original bio. Encountering a blocked RAID device calls free_r1bio(), which can release that original bio prematurely, causing a use-after-free. The cited fix frees the not-yet-issued r1_bio directly with mempool_free(). CVSS 3.1 is 7.8: local, low complexity, low privileges, no user interaction, with potentially high confidentiality, integrity, and availability impact.
Likely exposure
Exposure is limited to Linux systems running an affected kernel and using software RAID1 where a member can enter the blocked state during writes. The bundle lists 6.6, 6.6.28, 6.8.7, and 6.9 as affected, but downstream distributions may backport fixes without changing their base version.
Exploitation context
The supplied CVSS vector requires local access and low privileges. The source demonstrates a kernel memory-safety failure under concurrent RAID1 writes and a blocked member. CISA KEV status is false, and the supplied sources provide no evidence of active exploitation, public weaponization, or remote reachability.
Researcher notes
The documented failure depends on r1_bio->bios[] holding the original bio before lower-device bios exist, followed by a blocked rdev path invoking free_r1bio(). The supplied trace confirms premature freeing; it does not establish reliable privilege escalation. Researchers should distinguish demonstrated memory corruption and availability impact from the broader theoretical CVSS confidentiality and integrity impacts.
Mitigation direction
Apply a vendor-supported kernel containing the cited RAID1 fix or its documented backport.
Prioritize RAID1 hosts where local untrusted users or workloads can perform storage writes.
If patching is delayed, follow distribution guidance for safe temporary RAID1 risk reduction.
Reboot into the corrected kernel where required, then confirm the active kernel version.
Validation and detection
Inventory active kernel versions and identify hosts using Linux software RAID1.
Check distribution advisories or package changelogs for a CVE-2024-35979 backport.
Confirm the running kernel, not merely the installed package, contains the fix.
Review kernel logs for RAID1 faults, bio errors, use-after-free reports, or unexplained crashes.
Avoid reproducing the fault on production storage; use controlled, disposable test systems if necessary.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cve · low confidence lookup
CVE-2024-35979 mapping review
Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.