CVE-2024-26704
JSON

7.8high

ext4: fix double-free of blocks due to wrong extents moved_len

Severity
7.8high CVSS:3.1 by Linux
Exploit likelihood
0.27% (higher than 20% of CVEs; EPSS, by FIRST)
Published
Last changed
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.

Affected

Product or packageVersionsReported by
Linux Linuxfrom 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 and 1 more
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.*
CVE List
linux linux_kernelfrom 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.8NVD
debian debian_linux10.0NVD

All scores

Linux7.8high CVSS:3.1CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
NVD7.8high CVSS:3.1CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

Classification

CWE-415

SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.

What each source says

CVE List

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.

NVD (es)

En el kernel de Linux, se ha resuelto la siguiente vulnerabilidad: ext4: corrige la doble liberación de bloques debido a extensiones incorrectas. moving_len En ext4_move_extents(), move_len solo se actualiza cuando todos los movimientos se ejecutan exitosamente y solo descarta las preasignaciones de orig_inode y donante_inode cuando se mueve_len no es cero. Cuando el bucle no sale después de mover con éxito algunas extensiones, moving_len no se actualiza y permanece en 0, por lo que no descarta las asignaciones previas. Si las extensiones movidas se superponen con las extensiones preasignadas, las extensiones superpuestas se liberan dos veces en ext4_mb_release_inode_pa() y ext4_process_freed_data() (como se describe en el commit 94d7c16cbbbd ("ext4: corrige la doble liberación de bloques con EXT4_IOC_MOVE_EXT")), y se incrementa bb_free dos veces. Por lo tanto, cuando se ejecuta trim, se activa un error de división cero en mb_update_avg_fragment_size() porque bb_free no es cero y bb_fragments es cero. Por lo tanto, actualice move_len después de cada movimiento de extensión para evitar el problema.

References

Sources

SourceRecordLicence
CVE ListCVE-2024-26704 changed 2026-08-05CVE Terms of Use
NVDCVE-2024-26704 changed 2026-08-04Public domain