Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1336 CNY

100%

CVE-2025-40209— btrfs: fix memory leak of qgroup_list in btrfs_add_qgroup_relation

Quick assessment

Affected
Linux Linux
Exploitation
No confirmed in-the-wild exploitation; assess based on exposure
Recommended action
Check the vendor advisory and references for a fixed version. If immediate upgrade is impossible, restrict exposure and increase monitoring.

Linux kernel是美国Linux基金会的开源操作系统Linux所使用的内核。 Linux kernel存在安全漏洞,该漏洞源于btrfs_add_qgroup_relation函数在无效qgroup级别时未释放预分配的qgroup_list结构,可能导致内存泄漏。

AI Predicted 5.5 Difficulty: Moderate EPSS 0.18% · P8

Affected Version Matrix 8

VendorProduct Version RangeStatus
Linux Linux 4addc1ffd67ad34394674dc91379dc04cfdd2537< 3412d0e973e8f8381747d69033eda809a57a2581 affected
4addc1ffd67ad34394674dc91379dc04cfdd2537< a4d9ebe23bcb79d9d057e3c995db73b7b3aae414 affected
4addc1ffd67ad34394674dc91379dc04cfdd2537< f260c6aff0b8af236084012d14f9f1bf792ea883 affected
6.11 affected
< 6.11 unaffected
6.12.58≤ 6.12.* unaffected
6.17.8≤ 6.17.* unaffected
6.18≤ * unaffected
Get alerts for future matching vulnerabilities Log in to subscribe

I. Basic Information for CVE-2025-40209

Vulnerability Information

Have questions about the vulnerability? See if Shenlong's analysis helps!
View Shenlong Deep Dive ↗

Although we use advanced large model technology, its output may still contain inaccurate or outdated information.Shenlong tries to ensure data accuracy, but please verify and judge based on the actual situation.

Vulnerability Title
btrfs: fix memory leak of qgroup_list in btrfs_add_qgroup_relation
Source: CVE Program / CVE List V5
Vulnerability 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 ... 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.
Source: CVE Program / CVE List V5
CVSS Information
N/A
Source: CVE Program / CVE List V5
Vulnerability Type
N/A
Source: CVE Program / CVE List V5
Vulnerability Title
Linux kernel 安全漏洞
Source: CNNVD (China National Vulnerability Database)
Vulnerability Description
Linux kernel是美国Linux基金会的开源操作系统Linux所使用的内核。 Linux kernel存在安全漏洞,该漏洞源于btrfs_add_qgroup_relation函数在无效qgroup级别时未释放预分配的qgroup_list结构,可能导致内存泄漏。
Source: CNNVD (China National Vulnerability Database)
CVSS Information
N/A
Source: CNNVD (China National Vulnerability Database)
Vulnerability Type
N/A
Source: CNNVD (China National Vulnerability Database)

Affected Products

Vendor Product Affected Versions CPE Subscribe
Linux Linux 4addc1ffd67ad34394674dc91379dc04cfdd2537 ~ 3412d0e973e8f8381747d69033eda809a57a2581 -
Linux Linux 6.11 -

II. Public POCs for CVE-2025-40209

# POC Description Source Link Shenlong Link
AI-Generated POC Premium

No public POC found.

Login to generate AI POC

III. Intelligence Information for CVE-2025-40209

登录查看更多情报信息。

Same Patch Batch · Linux · 2025-11-21 · 3 CVEs total

CVE-2025-40210 7.5 HIGH Revert "NFSD: Remove the cap on number of operations per NFSv4 COMPOUND"
CVE-2025-40211 ACPI: video: Fix use-after-free in acpi_video_switch_brightness()

IV. Related Vulnerabilities

V. Comments for CVE-2025-40209

No comments yet


Leave a comment