Linux Kernel up to 6.12.57/6.17.7/6.18-rc4 btrfs_add_qgroup_relation return value

CVSS Meta Temp Score
CVSS is a standardized scoring system to determine possibilities of attacks. The Temp Score considers temporal factors like disclosure, exploit and countermeasures. The unique Meta Score calculates the average score of different sources to provide a normalized scoring system.
Current Exploit Price (≈)
Our analysts are monitoring exploit markets and are in contact with vulnerability brokers. The range indicates the observed or calculated exploit price to be seen on exploit markets. A good indicator to understand the monetary effort required for and the popularity of an attack.
CTI Interest Score
Our Cyber Threat Intelligence team is monitoring different web sites, mailing lists, exploit markets and social media networks. The CTI Interest Score identifies the interest of attackers and the security community for this specific vulnerability in real-time. A high score indicates an elevated risk to be targeted for this vulnerability.
5.3$0-$5k0.00

Summaryinfo

A vulnerability has been found in Linux Kernel up to 6.12.57/6.17.7/6.18-rc4 and classified as critical. This affects the function btrfs_add_qgroup_relation. The manipulation leads to return value. This vulnerability is listed as CVE-2025-40209. There is no available exploit. The affected component should be upgraded.

Detailsinfo

A vulnerability was found in Linux Kernel up to 6.12.57/6.17.7/6.18-rc4 and classified as critical. This issue affects the function btrfs_add_qgroup_relation. The manipulation with an unknown input leads to a return value vulnerability. Using CWE to declare the problem leads to CWE-252. The product does not check the return value from a method or function, which can prevent it from detecting unexpected states and conditions. The impact remains unknown. The summary by CVE is:

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 ... kfree(prealloc); // This becomes kfree(NULL), does nothing When the level check fails, 'prealloc' is never freed by either the callee or the caller, resulting in a 64-byte memory leak per failed operation. This can be triggered repeatedly by an unprivileged user with access to a writable btrfs mount, potentially exhausting kernel memory. Fix this by freeing prealloc before the early return, ensuring prealloc is always freed on all error paths.

It is possible to read the advisory at git.kernel.org. The identification of this vulnerability is CVE-2025-40209 since 04/16/2025. Technical details of the vulnerability are known, but there is no available exploit. The pricing for an exploit might be around USD $0-$5k at the moment (estimation calculated on 05/19/2026).

The vulnerability scanner Nessus provides a plugin with the ID 276580 (Linux Distros Unpatched Vulnerability : CVE-2025-40209), which helps to determine the existence of the flaw in a target environment.

Upgrading to version 6.12.58, 6.17.8 or 6.18-rc5 eliminates this vulnerability. Applying the patch 3412d0e973e8f8381747d69033eda809a57a2581/a4d9ebe23bcb79d9d057e3c995db73b7b3aae414/f260c6aff0b8af236084012d14f9f1bf792ea883 is able to eliminate this problem. The bugfix is ready for download at git.kernel.org. The best possible mitigation is suggested to be upgrading to the latest version.

The vulnerability is also documented in the databases at Tenable (276580) and CERT Bund (WID-SEC-2025-2658). Statistical analysis made it clear that VulDB provides the best quality for vulnerability data.

Affected

  • Debian Linux
  • Amazon Linux 2
  • Red Hat Enterprise Linux
  • Ubuntu Linux
  • SUSE Linux
  • Oracle Linux
  • SUSE openSUSE
  • Open Source Linux Kernel

Productinfo

Type

Vendor

Name

Version

License

Website

CPE 2.3info

CPE 2.2info

CVSSv4info

VulDB Vector: 🔒
VulDB Reliability: 🔍

CVSSv3info

VulDB Meta Base Score: 5.5
VulDB Meta Temp Score: 5.3

VulDB Base Score: 5.5
VulDB Temp Score: 5.3
VulDB Vector: 🔒
VulDB Reliability: 🔍

CVSSv2info

AVACAuCIA
💳💳💳💳💳💳
💳💳💳💳💳💳
💳💳💳💳💳💳
VectorComplexityAuthenticationConfidentialityIntegrityAvailability
UnlockUnlockUnlockUnlockUnlockUnlock
UnlockUnlockUnlockUnlockUnlockUnlock
UnlockUnlockUnlockUnlockUnlockUnlock

VulDB Base Score: 🔒
VulDB Temp Score: 🔒
VulDB Reliability: 🔍

Exploitinginfo

Class: Return value
CWE: CWE-252 / CWE-253
CAPEC: 🔒
ATT&CK: 🔒

Physical: No
Local: No
Remote: Partially

Availability: 🔒
Status: Not defined

EPSS Score: 🔒
EPSS Percentile: 🔒

Price Prediction: 🔍
Current Price Estimation: 🔒

0-DayUnlockUnlockUnlockUnlock
TodayUnlockUnlockUnlockUnlock

Nessus ID: 276580
Nessus Name: Linux Distros Unpatched Vulnerability : CVE-2025-40209

Threat Intelligenceinfo

Interest: 🔍
Active Actors: 🔍
Active APT Groups: 🔍

Countermeasuresinfo

Recommended: Upgrade
Status: 🔍

0-Day Time: 🔒

Upgrade: Kernel 6.12.58/6.17.8/6.18-rc5
Patch: 3412d0e973e8f8381747d69033eda809a57a2581/a4d9ebe23bcb79d9d057e3c995db73b7b3aae414/f260c6aff0b8af236084012d14f9f1bf792ea883

Timelineinfo

04/16/2025 CVE reserved
11/21/2025 +219 days Advisory disclosed
11/21/2025 +0 days VulDB entry created
05/19/2026 +179 days VulDB entry last update

Sourcesinfo

Vendor: kernel.org

Advisory: git.kernel.org
Status: Confirmed

CVE: CVE-2025-40209 (🔒)
GCVE (CVE): GCVE-0-2025-40209
GCVE (VulDB): GCVE-100-333203
CERT Bund: WID-SEC-2025-2658 - Linux Kernel: Mehrere Schwachstellen ermöglichen Denial of Service

Entryinfo

Created: 11/21/2025 11:28
Updated: 05/19/2026 19:13
Changes: 11/21/2025 11:28 (58), 11/21/2025 16:38 (7), 11/23/2025 05:24 (2), 01/06/2026 10:19 (1), 02/24/2026 13:54 (1), 05/19/2026 19:13 (1)
Complete: 🔍
Cache ID: 216::103

Statistical analysis made it clear that VulDB provides the best quality for vulnerability data.

Discussion

No comments yet. Languages: en.

Please log in to comment.

Do you know our Splunk app?

Download it now for free!