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

- Severity: High 7.8 (CVSS:3.1, scored by Linux) `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.27%, higher than 20% of CVEs (2026-12-01)
- Published: 2024-04-03T14:55:02.672Z
- Modified: 2026-08-05T11:26:47.486Z
- Weaknesses: CWE-415
- SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial
- Assigned by: Linux

## 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.

(As written by CVE List.)

## Affected

- Linux Linux: from fcf6b1b729bcd23f2b49a84fb33ffbb44712ee6a before b4fbb89d722cbb16beaaea234b7230faaaf68c71; from fcf6b1b729bcd23f2b49a84fb33ffbb44712ee6a before afbcad9ae7d6d11608399188f03a837451b6b3a1; from fcf6b1b729bcd23f2b49a84fb33ffbb44712ee6a before d033a555d9a1cf53dbf3301af7199cc4a4c8f537; from fcf6b1b729bcd23f2b49a84fb33ffbb44712ee6a before afba9d11320dad5ce222ac8964caf64b7b4bedb1; from fcf6b1b729bcd23f2b49a84fb33ffbb44712ee6a before 185eab30486ba3e7bf8b9c2e049c79a06ffd2bc1; from fcf6b1b729bcd23f2b49a84fb33ffbb44712ee6a before 2883940b19c38d5884c8626483811acf4d7e148f; from fcf6b1b729bcd23f2b49a84fb33ffbb44712ee6a before 559ddacb90da1d8786dd8ec4fd76bbfa404eaef6; from fcf6b1b729bcd23f2b49a84fb33ffbb44712ee6a before 55583e899a5357308274601364741a83e78d6ac4; 3.18 (not affected: before 3.18; from 4.19.307 up to 4.19.*; from 5.4.269 up to 5.4.*; from 5.10.210 up to 5.10.*; from 5.15.149 up to 5.15.*; from 6.1.79 up to 6.1.*; from 6.6.18 up to 6.6.*; from 6.7.6 up to 6.7.*; from 6.8 up to *)
- linux linux_kernel: from 3.18 before 4.19.307; from 4.20 before 5.4.269; from 5.5 before 5.10.210; from 5.11 before 5.15.149; from 5.16 before 6.1.79; from 6.2 before 6.6.18; from 6.7 before 6.7.6; 6.8
- debian debian_linux: 10.0

## Every score

- Linux: CVSS:3.1 7.8 High `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`
- NVD: CVSS:3.1 7.8 High `CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`

## References

- <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> (patch)
- <https://lists.debian.org/debian-lts-announce/2024/06/msg00017.html> (mailing-list)
- <https://lists.debian.org/debian-lts-announce/2024/06/msg00020.html> (mailing-list)

## Sources

- CVE List: [CVE-2024-26704](https://www.cve.org/CVERecord?id=CVE-2024-26704), CVE Terms of Use, modified 2026-08-05
- NVD: [CVE-2024-26704](https://nvd.nist.gov/vuln/detail/CVE-2024-26704), Public domain, modified 2026-08-04

---

Page: https://cve.day/CVE-2024-26704 · Whole record: https://cve.day/CVE-2024-26704.json · Rebuilt by cve.day 2026-11-25T22:58:38.526Z
