Skip to content
Heist/ feed
Back to feed
UnratedFix available

netfs: fix reference leak

Type: advisorySources: OSV

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() ca

Products
Kernel
Affected versions
Not specified
Fixed versions
6.16.10
CVEs
CVE-2025-40007
Confirmed fixed CVEs
Not specified
Updated in this feed
4 Nov 2026, 18:53 UTC · Revision 1

Source evidence

netfs: fix reference leak

core-osv · Original source

Published 20 Oct 2025, 15:26 UTC

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() ca

osv:CVE-2025-40007

Kernel

Fixed versions: 6.16.10

Complete source record
{
  "id": "f31b5702b577002b5ebbe3a512654fd117822553b29931699e87d85c02571953",
  "url": "https://osv.dev/vulnerability/CVE-2025-40007",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "netfs: fix reference leak",
    "summary": "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() ca",
    "evidence": "osv:CVE-2025-40007",
    "products": [
      {
        "name": {
          "value": "Kernel",
          "evidence": "/affected/1/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [
          {
            "value": "6.16.10",
            "evidence": "/affected/1/ranges"
          }
        ],
        "affected_versions": []
      }
    ],
    "severity": "unknown",
    "structured": {
      "id": "CVE-2025-40007",
      "aliases": [
        "CVE-2025-40007"
      ],
      "affected": [
        {
          "ranges": [
            {
              "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
              "type": "GIT",
              "events": [
                {
                  "introduced": "20d72b00ca814d748f5663484e5c53bb2bf37a3a"
                },
                {
                  "fixed": "8df142e93098b4531fadb5dfcf93087649f570b3"
                },
                {
                  "fixed": "4d428dca252c858bfac691c31fa95d26cd008706"
                }
              ]
            },
            {
              "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
              "type": "GIT",
              "events": [
                {
                  "introduced": "6.15.3"
                },
                {
                  "fixed": "6.16"
                }
              ]
            },
            {
              "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
              "type": "GIT",
              "events": [
                {
                  "introduced": "1a8360c2eed3b292ed654c2ac61b09de4a80e298"
                }
              ]
            }
          ],
          "versions": [
            "v6.15.11",
            "v6.15.10",
            "v6.15.9",
            "v6.15.8",
            "v6.15.7",
            "v6.15.6",
            "v6.15.5",
            "v6.15.4",
            "v6.15.3"
          ],
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2025-40007.json"
          }
        },
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "6.16.0"
                },
                {
                  "fixed": "6.16.10"
                }
              ]
            }
          ],
          "package": {
            "name": "Kernel",
            "ecosystem": "Linux"
          },
          "database_specific": {
            "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2025-40007.json"
          }
        }
      ],
      "modified": "2026-10-28T02:30:38.462723165Z",
      "provider": "osv",
      "references": [
        "https://git.kernel.org/stable/c/4d428dca252c858bfac691c31fa95d26cd008706",
        "https://git.kernel.org/stable/c/8df142e93098b4531fadb5dfcf93087649f570b3",
        "https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/40xxx/CVE-2025-40007.json",
        "https://nvd.nist.gov/vuln/detail/CVE-2025-40007",
        "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git"
      ],
      "provider_metadata": {
        "cna_assigner": "Linux",
        "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/40xxx/CVE-2025-40007.json"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2025-40007",
        "evidence": "/id"
      }
    ],
    "security_relevant": true,
    "severity_evidence": null
  },
  "source_id": "core-osv",
  "document_id": 505893,
  "published_at": "2025-10-20T15:26:53.88+00:00"
}