Skip to contentSkip to conversation

CVE-2026-99136: dm-crypt: fix a tiny race condition in crypt_dec_pending

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Oct 28

lore
Share & tools
lore
#0 lore raw

From: Greg Kroah-Hartman <[email protected]>

Description
===========

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.

The Linux kernel CVE team has assigned CVE-2026-99136 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 2.6.29 with commit b35f8caa0890169000fec22902290d9a15274cbd and fixed in 6.18.59 with commit ac5d887ab93592fc5e3605fe30c1d8d232d609b3
	Issue introduced in 2.6.29 with commit b35f8caa0890169000fec22902290d9a15274cbd and fixed in 7.2.13 with commit 4f16bb982b27b9f5a15301f622c318001fe521f8
	Issue introduced in 2.6.29 with commit b35f8caa0890169000fec22902290d9a15274cbd and fixed in 7.3 with commit 148845aa1921d95ef5dc851c76e6a284f6657df6
	Issue introduced in 2.6.28.9 with commit 9c8f3fcd3ffd3283cc0971c8919058356f20a963

Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at

	https://cve.org/CVERecord/?id=CVE-2026-99136

will be updated if fixes are backported, please check that for the most up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
drivers/md/dm-crypt.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:

	https://git.kernel.org/stable/c/ac5d887ab93592fc5e3605fe30c1d8d232d609b3
	https://git.kernel.org/stable/c/4f16bb982b27b9f5a15301f622c318001fe521f8
	https://git.kernel.org/stable/c/148845aa1921d95ef5dc851c76e6a284f6657df6