{
  "schema_version": "1.6.1",
  "id": "RPI-CVE-2025-40342",
  "modified": "2026-10-09T11:39:44Z",
  "upstream": [
    "CVE-2025-40342"
  ],
  "published": "2025-12-09T04:10:29Z",
  "summary": "nvme-fc: use lock accessing port_state and rport state",
  "details": "In the Linux kernel, the following vulnerability has been resolved:\n\nnvme-fc: use lock accessing port_state and rport state\n\nnvme_fc_unregister_remote removes the remote port on a lport object at\nany point in time when there is no active association. This races with\nwith the reconnect logic, because nvme_fc_create_association is not\ntaking a lock to check the port_state and atomically increase the\nactive count on the rport.",
  "severity": [
    {
      "type": "CVSS_V3",
      "score": "CVSS:3.1/AV:A/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
    }
  ],
  "affected": [
    {
      "package": {
        "ecosystem": "Raspberry Pi OS:12",
        "name": "linux"
      },
      "versions": [
        "1:6.1.47-1+rpt4"
      ],
      "ecosystem_specific": {
        "binaries": [
          {
            "binary_name": "linux-image-6.1.0-rpi3-rpi-2712",
            "binary_version": "1:6.1.47-1+rpt4"
          },
          {
            "binary_name": "linux-image-6.1.0-rpi3-rpi-v6",
            "binary_version": "1:6.1.47-1+rpt4"
          },
          {
            "binary_name": "linux-image-6.1.0-rpi3-rpi-v7",
            "binary_version": "1:6.1.47-1+rpt4"
          },
          {
            "binary_name": "linux-image-6.1.0-rpi3-rpi-v7l",
            "binary_version": "1:6.1.47-1+rpt4"
          },
          {
            "binary_name": "linux-image-6.1.0-rpi3-rpi-v8",
            "binary_version": "1:6.1.47-1+rpt4"
          }
        ]
      },
      "database_specific": {
        "per_version": {
          "1:6.1.47-1+rpt4": {
            "linux_commit": "655fc658a15ae7a6f37103754adb39ba52a9a14e",
            "upstream_version": "6.1.47",
            "assessment": "commit ancestry (strak rule)",
            "upstream_fixed": "6.1.159",
            "compiled_filter": false
          }
        }
      }
    }
  ],
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://www.cve.org/CVERecord?id=CVE-2025-40342"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/de3d91af47bc015031e7721b100a29989f6498a5"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/e8cde03de8674b05f2c5e0870729049eba517800"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/4253e0a4546138a2bf9cb6acf66b32fee677fc7c"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/25f4bf1f7979a7871974fd36c79d69ff1cf4b446"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/9950af4303942081dc8c7a5fdc3688c17c7eb6c0"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/a2f7fa75c4a2a07328fa22ccbef461db76790b55"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/891cdbb162ccdb079cd5228ae43bdeebce8597ad"
    }
  ],
  "database_specific": {
    "source": "https://git.kernel.org/pub/scm/linux/security/vulns.git",
    "upstream_modified": "2026-08-05T12:19:11Z",
    "severity": {
      "source": "kernel CNA",
      "cvss_v3_score": 8.8,
      "cvss_v3_severity": "High",
      "scenario": "AV:A - Both halves of the race are driven by a remote NVMe-FC peer over the Fibre Channel fabric \u2014 target logout/RSCN triggers `nvme_fc_unregister_remoteport()` while association failure triggers the host's reconnect worker \u2014 so no host access is needed, but FC/FCoE is a limited, non-routable storage network requiring the attacker to be attached to the same fabric.\nAC:L - The attacker controls both sides of the race and can repeat login/logout plus association-failure cycles indefinitely, and the host's reconnect logic re-enters `nvme_fc_create_association()` automatically on every cycle, so the window is hit reliably given enough iterations.\nPR:N - FC-NVMe performs no peer authentication \u2014 fabric zoning is the only access control \u2014 so a rogue or compromised port on the SAN needs no credentials or account on the victim host to drive the port-state transitions.\nUI:N - The reconnect path runs entirely in kernel workqueue context (`nvme_fc_connect_ctrl_work`) in response to fabric events; no administrator or user action on the victim is required.\nS:U - The corruption is confined to kernel objects owned by the nvme-fc transport and the FC HBA driver within the same security authority; no VM, IOMMU, or sandbox boundary is crossed.\nC:H - The double `remoteport_delete()` causes a refcount underflow and premature free of the LLDD node structure (lpfc `ndlp`, qla2xxx `fcport`) while the transport continues to dereference it, and such a use-after-free on a heap object gives an attacker able to groom the slab an arbitrary kernel read primitive.\nI:H - The same use-after-free/double-put lets a reclaimed allocation be written through stale transport pointers and function-pointer-bearing structures (`lport->ops`, `rport->ndlp`), which is exploitable for arbitrary write and control-flow hijack.\nA:H - Even unweaponized, the double free and continued use of a torn-down remote port reliably produce kref underflow warnings, KASAN use-after-free splats, and kernel panics, taking down storage-attached hosts."
    }
  }
}
