Menu

Star on GitHub · 3.2k

CVE-2025-40209

In the Linux kernel, the following vulnerability has been resolved: btrfs: fix memory leak of qgroup_list in btrfs_add_qgroup_relation When btrfs_add_qgroup_relation() is called with invalid qgro…

Published Nov 21, 2025EPSS 0.18%

Overview

CVE-2025-40209 is a known-severity vulnerability. It was published on November 21, 2025.

Technical description

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

btrfs: fix memory leak of qgroup_list in btrfs_add_qgroup_relation

When btrfs_add_qgroup_relation() is called with invalid qgroup levels

(src >= dst), the function returns -EINVAL directly without freeing the

preallocated qgroup_list structure passed by the caller. This causes a

memory leak because the caller unconditionally sets the pointer to NULL

after the call, preventing any cleanup.

The issue occurs because the level validation check happens before the

mutex is acquired and before any error handling path that would free

the prealloc pointer. On this early return, the cleanup code at the

'out' label (which includes kfree(prealloc)) is never reached.

In btrfs_ioctl_qgroup_assign(), the code pattern is:

prealloc = kzalloc(sizeof(*prealloc), GFP_KERNEL);

ret = btrfs_add_qgroup_relation(trans, sa->src, sa->dst, prealloc);

prealloc = NULL; // Always set to NULL regardless of return value

...

k

Remediation

Check the references section for vendor advisories, patches, and mitigation guidance. If immediate patching is not possible, review the CVSS vector to understand the attack surface and apply compensating controls such as network segmentation or access restrictions.

Frequently asked questions

What is CVE-2025-40209?

CVE-2025-40209 is a known-severity vulnerability. It was published on November 21, 2025.

How severe is CVE-2025-40209?

CVSS score information is not yet available for this vulnerability. Check back as the CVE record is updated by NVD analysts.

How do I fix or remediate CVE-2025-40209?

Check the references section for vendor advisories, patches, and mitigation guidance. If immediate patching is not possible, review the CVSS vector to understand the attack surface and apply compensating controls such as network segmentation or access restrictions.

How can CyberStrike help with CVE-2025-40209?

CyberStrike is an open-source, AI-augmented pentesting engine. Rather than flag a version number, it tests whether an issue like CVE-2025-40209 is actually reachable in your own applications and APIs, then verifies each finding before reporting it. That tells you if the weakness is a real, exploitable risk in your environment or a false positive you can safely deprioritize.