Search CVEs and advisories

Search CVEs and Linux security advisories by vendor, product, package, or severity, and see which vulnerabilities each advisory addresses.

CVE

CVE-2025-40007

published

netfs: fix reference leak

Published
20 Oct 2025, 15:26:53 UTC
Updated
23 May 2026, 16:01:14 UTC
Language
en

Package status and fixes

Distro / vendorReleasePackage / productPublisher statusFixed buildSource
Linux — Linux20d72b00ca814d748f5663484e5c53bb2bf37a3a to < 8df142e93098b4531fadb5dfcf93087649f570b3 · 20d72b00ca814d748f5663484e5c53bb2bf37a3a to < 4d428dca252c858bfac691c31fa95d26cd008706 · 1a8360c2eed3b292ed654c2ac61b09de4a80e298 · 6.15.3 to < 6.16 · Other versions: unaffected Affected Not stated Linux
Linux — Linux6.16 (affected) · 0 to < 6.16 (unaffected · semver) · 6.16.10 through 6.16.* (unaffected · semver) · 6.17 and later (unaffected · original_commit_for_fix) · Other versions: affected Version-specific Not stated Linux
Amazon Linux AL2 Release evaluation Not Affected Not required Amazon Linux assessment
Amazon Linux AL2023 Release evaluation Not Affected Not required Amazon Linux assessment

Description

In the Linux kernel, the following vulnerability has been resolved: netfs: fix reference leak Commit 20d72b00ca81 ("netfs: Fix the request's work item to not require a ref") modified netfs_alloc_request() to initialize the reference counter to 2 instead of 1. The rationale was that the requet's "work" would release the second reference after completion (via netfs_{read,write}_collection_worker()). That works most of the time if all goes well. However, it leaks this additional reference if the request is released before the I/O operation has been submitted: the error code path only decrements the reference counter once and the work item will never be queued because there will never be a completion. This has caused outages of our whole server cluster today because tasks were blocked in netfs_wait_for_outstanding_io(), leading to deadlocks in Ceph (another bug that I will address soon in another patch). This was caused by a netfs_pgpriv2_begin_copy_to_cache() call which failed in fscache_begin_write_operation(). The leaked netfs_io_request was never completed, leaving `netfs_inode.io_count` with a positive value forever. All of this is super-fragile code. Finding out which code paths will lead to an eventual completion and which do not is hard to see: - Some functions like netfs_create_write_req() allocate a request, but will never submit any I/O. - netfs_unbuffered_read_iter_locked() calls netfs_unbuffered_read() and then netfs_put_request(); however, netfs_unbuffered_read() can also fail early before submitting the I/O request, therefore another netfs_put_request() call must be added there. A rule of thumb is that functions that return a `netfs_io_request` do not submit I/O, and all of their callers must be checked. For my taste, the whole netfs code needs an overhaul to make reference counting easier to understand and less fragile & obscure. But to fix this bug here and now and produce a patch that is adequate for a stable backport, I tried a minimal approach that quickly frees the request object upon early failure. I decided against adding a second netfs_put_request() each time because that would cause code duplication which obscures the code further. Instead, I added the function netfs_put_failed_request() which frees such a failed request synchronously under the assumption that the reference count is exactly 2 (as initially set by netfs_alloc_request() and never touched), verified by a WARN_ON_ONCE(). It then deinitializes the request object (without going through the "cleanup_work" indirection) and frees the allocation (with RCU protection to protect against concurrent access by netfs_requests_seq_start()). All code paths that fail early have been changed to call netfs_put_failed_request() instead of netfs_put_request(). Additionally, I have added a netfs_put_request() call to netfs_unbuffered_read() as explained above because the netfs_put_failed_request() approach does not work there.

en · Linux · cna

Vendor advisories explicitly linked to this CVE.

0

No linked advisories were found for this CVE.

Assessment

CVSS risk assessment and additional context for this vulnerability.

No normalized assessments.

Publisher product statements

Version ranges and default statuses as reported by each provider.

Affected vendor and product assertions
VendorProductVersion statusSource
Linux Linux 20d72b00ca814d748f5663484e5c53bb2bf37a3a to < 8df142e93098b4531fadb5dfcf93087649f570b3 (affected · git)20d72b00ca814d748f5663484e5c53bb2bf37a3a to < 4d428dca252c858bfac691c31fa95d26cd008706 (affected · git)1a8360c2eed3b292ed654c2ac61b09de4a80e298 (affected · git)6.15.3 to < 6.16 (affected · semver)Default: unaffected Linux · cna
Linux Linux 6.16 (affected)0 to < 6.16 (unaffected · semver)6.16.10 through 6.16.* (unaffected · semver)6.17 and later (unaffected · original_commit_for_fix)Default: affected Linux · cna

Weaknesses

0

No weakness assertions.

References

2

Provider assertions

1

Linux · cna

netfs: fix reference leak

Provenance

Schema
5.2
Searchable
yes
Content hash
6434d8e34c841f1610363081e78742c05416680a552f95fded908c428e8f9206
Ingested
23 Sep 2026, 08:48:04 UTC
Source record
Official CVE record

Search filters

Match options apply to free text. CVE words match tokens; use contains:"…" for literal substrings.

Text

Words and phrases
buffer overflow "remote code execution"
Word prefix
auth*
Literal substring (title or description)
contains:"use-after-free"
Exclude a term or filter
-test -vendor:example

Affected product

Vendor
vendor:Example
Product
product:"Demo Widget"

Severity and score

Severity · none, low, medium, high, critical, unknown
severity:critical
CWE identifier
cwe:CWE-863
CVSS score (0–10)
cvss:>=7.0

Dates and status

Published date · comparisons, relative days
published:>=2026-01-01
Updated date · comparisons, relative days
updated:<30d
Status · published (default), rejected, unknown
status:rejected