# CVE-2024-26704: ext4: fix double-free of blocks due to wrong extents moved\_len

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** HIGH 7.8
- **CVSS:** 7.8 (v3.1, CNA) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: Low; User interaction: None; Scope: Unchanged; Confidentiality impact: High; Integrity impact: High; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.34% (percentile 20, 2026-11-26)
- **CWE:** CWE-415
- **Published:** 2024-04-03T14:55:02.672Z
- **Modified:** 2026-08-05T11:26:47.486Z

## Who should check

- Anyone running Linux \>= fcf6b1b729bcd23f2b49a84fb33ffbb44712ee6a, \< b4fbb89d722cbb16beaaea234b7230faaaf68c71; \>= fcf6b1b729bcd23f2b49a84fb33ffbb44712ee6a, \< afbcad9ae7d6d11608399188f03a837451b6b3a1; \>= fcf6b1b729bcd23f2b49a84fb33ffbb44712ee6a, \< d033a555d9a1cf53dbf3301af7199cc4a4c8f537; \>= fcf6b1b729bcd23f2b49a84fb33ffbb44712ee6a, \< afba9d11320dad5ce222ac8964caf64b7b4bedb1; \>= fcf6b1b729bcd23f2b49a84fb33ffbb44712ee6a, \< 185eab30486ba3e7bf8b9c2e049c79a06ffd2bc1; \>= fcf6b1b729bcd23f2b49a84fb33ffbb44712ee6a, \< 2883940b19c38d5884c8626483811acf4d7e148f; \>= fcf6b1b729bcd23f2b49a84fb33ffbb44712ee6a, \< 559ddacb90da1d8786dd8ec4fd76bbfa404eaef6; \>= fcf6b1b729bcd23f2b49a84fb33ffbb44712ee6a, \< 55583e899a5357308274601364741a83e78d6ac4
- Anyone running Linux 3.18

## Description

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

ext4: fix double-free of blocks due to wrong extents moved\_len

In ext4\_move\_extents(), moved\_len is only updated when all moves are
successfully executed, and only discards orig\_inode and donor\_inode
preallocations when moved\_len is not zero. When the loop fails to exit
after successfully moving some extents, moved\_len is not updated and
remains at 0, so it does not discard the preallocations.

If the moved extents overlap with the preallocated extents, the
overlapped extents are freed twice in ext4\_mb\_release\_inode\_pa() and
ext4\_process\_freed\_data() (as described in commit 94d7c16cbbbd ("ext4:
Fix double-free of blocks with EXT4\_IOC\_MOVE\_EXT")), and bb\_free is
incremented twice. Hence when trim is executed, a zero-division bug is
triggered in mb\_update\_avg\_fragment\_size() because bb\_free is not zero
and bb\_fragments is zero.

Therefore, update move\_len after each extent move to avoid the issue.

## Affected and fixed versions

- Linux: \>= fcf6b1b729bcd23f2b49a84fb33ffbb44712ee6a, \< b4fbb89d722cbb16beaaea234b7230faaaf68c71; \>= fcf6b1b729bcd23f2b49a84fb33ffbb44712ee6a, \< afbcad9ae7d6d11608399188f03a837451b6b3a1; \>= fcf6b1b729bcd23f2b49a84fb33ffbb44712ee6a, \< d033a555d9a1cf53dbf3301af7199cc4a4c8f537; \>= fcf6b1b729bcd23f2b49a84fb33ffbb44712ee6a, \< afba9d11320dad5ce222ac8964caf64b7b4bedb1; \>= fcf6b1b729bcd23f2b49a84fb33ffbb44712ee6a, \< 185eab30486ba3e7bf8b9c2e049c79a06ffd2bc1; \>= fcf6b1b729bcd23f2b49a84fb33ffbb44712ee6a, \< 2883940b19c38d5884c8626483811acf4d7e148f; \>= fcf6b1b729bcd23f2b49a84fb33ffbb44712ee6a, \< 559ddacb90da1d8786dd8ec4fd76bbfa404eaef6; \>= fcf6b1b729bcd23f2b49a84fb33ffbb44712ee6a, \< 55583e899a5357308274601364741a83e78d6ac4 (cvelist)
- Linux: 3.18 (cvelist)

## Mitigation

- Upgrade Linux to 55583e899a5357308274601364741a83e78d6ac4 or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2024-26704. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2024-26704.md
Affected: Linux >= fcf6b1b729bcd23f2b49a84fb33ffbb44712ee6a, < b4fbb89d722cbb16beaaea234b7230faaaf68c71; >= fcf6b1b729bcd23f2b49a84fb33ffbb44712ee6a, < afbcad9ae7d6d11608399188f03a837451b6b3a1; >= fcf6b1b729bcd23f2b49a84fb33ffbb44712ee6a, < d033a555d9a1cf53dbf3301af7199cc4a4c8f537; >= fcf6b1b729bcd23f2b49a84…
Fixed in: Linux 185eab30486ba3e7bf8b9c2e049c79a06ffd2bc1, Linux 2883940b19c38d5884c8626483811acf4d7e148f, Linux 559ddacb90da1d8786dd8ec4fd76bbfa404eaef6, Linux 55583e899a5357308274601364741a83e78d6ac4

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2024-26704 being exploited?

There is no confirmed exploitation: CVE-2024-26704 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.34% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2024-26704?

High: CVSS 7.8 (v3.1, scored by CNA). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2024-26704?

Linux \>= fcf6b1b729bcd23f2b49a84fb33ffbb44712ee6a, \< b4fbb89d722cbb16beaaea234b7230faaaf68c71; \>= fcf6b1b729bcd23f2b49a84fb33ffbb44712ee6a, \< afbcad9ae7d6d11608399188f03a837451b6b3a1; \>= fcf6b1b729bcd23f2b49a84fb33ffbb44712ee6a, \< d033a555d9a1cf53dbf3301af7199cc4a4c8f537; \>= fcf6b1b729bcd23f2b49a84fb33ffbb44712ee6a, \< afba9d11320dad5ce222ac8964caf64b7b4bedb1; \>= fcf6b1b729bcd23f2b49a84fb33ffbb44712ee6a, \< 185eab30486ba3e7bf8b9c2e049c79a06ffd2bc1; \>= fcf6b1b729bcd23f2b49a84fb33ffbb44712ee6a, \< 2883940b19c38d5884c8626483811acf4d7e148f; \>= fcf6b1b729bcd23f2b49a84fb33ffbb44712ee6a, \< 559ddacb90da1d8786dd8ec4fd76bbfa404eaef6; \>= fcf6b1b729bcd23f2b49a84fb33ffbb44712ee6a, \< 55583e899a5357308274601364741a83e78d6ac4; Linux 3.18.

### Is there a fix for CVE-2024-26704?

Yes. Fixed in Linux 185eab30486ba3e7bf8b9c2e049c79a06ffd2bc1, Linux 2883940b19c38d5884c8626483811acf4d7e148f, Linux 559ddacb90da1d8786dd8ec4fd76bbfa404eaef6, Linux 55583e899a5357308274601364741a83e78d6ac4. Upgrade Linux to 55583e899a5357308274601364741a83e78d6ac4 or later.

### How do I check if I'm affected by CVE-2024-26704?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- patch: <https://git.kernel.org/stable/c/b4fbb89d722cbb16beaaea234b7230faaaf68c71>
- patch: <https://git.kernel.org/stable/c/afbcad9ae7d6d11608399188f03a837451b6b3a1>
- patch: <https://git.kernel.org/stable/c/d033a555d9a1cf53dbf3301af7199cc4a4c8f537>
- patch: <https://git.kernel.org/stable/c/afba9d11320dad5ce222ac8964caf64b7b4bedb1>
- patch: <https://git.kernel.org/stable/c/185eab30486ba3e7bf8b9c2e049c79a06ffd2bc1>
- patch: <https://git.kernel.org/stable/c/2883940b19c38d5884c8626483811acf4d7e148f>
- patch: <https://git.kernel.org/stable/c/559ddacb90da1d8786dd8ec4fd76bbfa404eaef6>
- patch: <https://git.kernel.org/stable/c/55583e899a5357308274601364741a83e78d6ac4>
- other: <https://lists.debian.org/debian-lts-announce/2024/06/msg00017.html>
- other: <https://lists.debian.org/debian-lts-announce/2024/06/msg00020.html>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2024-26704>

HTML: <https://flawdb.com/CVE-2024-26704> · JSON: <https://flawdb.com/api/v1/entries/CVE-2024-26704>
