KernelScan.io

HIGH Introduced in 2.6.29

dm-crypt DecPending Race

CVE-2026-99136

CVSS 7.0 / 10.0 NVD

CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H

KernelScan AI7.0HIGH

01

In the Linux kernel, the following vulnerability has been resolved: dm-crypt: fix a tiny race condition in crypt_dec_pending crypt_dec_pending reads io->error before calling atomic_dec_and_test. Another context, for example crypt_endio called from an interrupt, may set io->error and drop its reference between the read and the decrement. crypt_dec_pending then drops the last reference and completes the bio with the stale status - so a read that failed and was never decrypted, or a write that failed, is reported as successful. The read was placed before the decrement by commit b35f8caa0890 ("dm crypt: wait for endio to complete before destruction"), because that commit freed dm_crypt_io before calling bio_endio. This is no longer the case, dm_crypt_io lives in the per-bio data now. Read io->error after atomic_dec_and_test instead. atomic_dec_and_test is fully ordered, so no additional barrier is needed.

02

Engine v0.10.0

Risk summary

A race condition in dm-crypt's completion path can cause failed encrypted I/O operations to be reported as successful. Any local user with read or write access to a file on an existing dm-crypt volume can trigger this by issuing I/O that fails at the lower layer, potentially leaking prior page contents on reads or silently corrupting filesystem metadata and data on writes. The bug affects all kernels since 2.6.29 where dm-crypt is in use.

Affecteddrivers/md/dm-crypt.c (dm-crypt)

Vulnerability analysis

The dm-crypt completion function crypt_dec_pending() reads the I/O error status before atomically decrementing a pending counter. An interrupt-context completion handler (crypt_endio) can update that error status and drop its reference in the tiny window between the read and the decrement. When crypt_dec_pending then sees the counter reach zero, it completes the bio with the stale error value it read earlier — turning a genuine failure into a false success. The fix reorders the operations so the error is read after the atomic decrement, which is fully ordered and guarantees visibility of any prior error store. The vulnerable path is reached through ordinary file read/write syscalls on a dm-crypt mapped device; no special privileges are needed beyond filesystem permissions on the encrypted volume, though creating the mapping initially requires root.

03

BranchIntroducedFixed inPatch commit
2.62.6.28.92.6.29445a6883f46d
5.102.6.295.10.2736f82e86471c9
5.152.6.295.15.2246ac8546df1f8
6.12.6.296.1.191056bf8322e39
6.122.6.296.12.115ac5d887ab935
6.182.6.296.18.594f16bb982b27
6.62.6.296.6.161d9d7069bb791
7.22.6.297.2.13148845aa1921
mainline2.6.297.3—
cip/6.122.6.296.12.117-cip35d9d7069bb791

04

State of the newest release of each Civil Infrastructure Platform SLTS tree, from CIP's own fix records.

CIP treeState
cip/6.12Fixed in 6.12.117-cip35
cip/6.1Affected — no CIP fix yet (latest 6.1.190-cip62)
cip/6.1-rtAffected — no CIP fix yet (latest 6.1.189-cip61-rt32)
cip/5.10Affected — no CIP fix yet (latest 5.10.272-cip79)
cip/5.10-rtAffected — no CIP fix yet (latest 5.10.272-cip79-rt35)
cip/4.19Affected — no CIP fix yet (latest 4.19.325-cip137)
cip/4.19-rtAffected — no CIP fix yet (latest 4.19.325-cip137-rt51)
cip/4.4Affected — no CIP fix yet (latest 4.4.302-cip116)
cip/4.4-rtAffected — no CIP fix yet (latest 4.4.302-cip115-rt63)