Skip to contentSkip to conversation

CVE-2025-21679: btrfs: add the missing error handling inside get_canonical_dev_path

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Jan 31, 2025

lore
Share & tools
lore
#0 lore raw

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

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

btrfs: add the missing error handling inside get_canonical_dev_path

Inside function get_canonical_dev_path(), we call d_path() to get the final device path.

But d_path() can return error, and in that case the next strscpy() call will trigger an invalid memory access.

Add back the missing error handling for d_path().

The Linux kernel CVE team has assigned CVE-2025-21679 to this issue.

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

	Issue introduced in 6.12.5 with commit 5d261f60b5c82ba1e4b5555252e1c90c43d96015 and fixed in 6.12.11 with commit d0fb5741932b831eded49bfaaf33353e96200d6d

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-2025-21679

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:
fs/btrfs/volumes.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/d0fb5741932b831eded49bfaaf33353e96200d6d
	https://git.kernel.org/stable/c/fe4de594f7a2e9bc49407de60fbd20809fad4192