{
  "schema_version": "1.6.1",
  "id": "RPI-CVE-2025-39942",
  "modified": "2026-10-09T11:39:44Z",
  "upstream": [
    "CVE-2025-39942"
  ],
  "published": "2025-10-04T07:33:57Z",
  "summary": "ksmbd: smbdirect: verify remaining_data_length respects max_fragmented_recv_size",
  "details": "In the Linux kernel, the following vulnerability has been resolved:\n\nksmbd: smbdirect: verify remaining_data_length respects max_fragmented_recv_size\n\nThis is inspired by the check for data_offset + data_length.",
  "severity": [
    {
      "type": "CVSS_V3",
      "score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/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.154",
            "compiled_filter": false
          }
        }
      }
    }
  ],
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://www.cve.org/CVERecord?id=CVE-2025-39942"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/196a3a7676d726ee67621ea2bf3b7815ac2685b4"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/d3cb3f209d35c44b7ee74f77ed27ebb28995b9ce"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/9644798294c7287e65a7b26e35aa6d2ce3345bcc"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/c64b915bb3d9339adcae5db4be2c35ffbef5e615"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/e1868ba37fd27c6a68e31565402b154beaa65df0"
    }
  ],
  "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": 7.5,
      "cvss_v3_severity": "High",
      "scenario": "AV:N - The flaw is in ksmbd's in-kernel SMB Direct (RDMA) transport receive completion handler, which parses `smb_direct_data_transfer` headers straight off the wire from a remote SMB client on the SMB Direct port (5445/445 over iWARP or RoCEv2, both routable). No local access is needed \u2014 a single crafted RDMA send from a remote peer reaches the vulnerable code.\nAC:L - `remaining_data_length` is a plain header field the attacker writes directly, and the attacker also controls `preferred_send_size` in the SMB Direct negotiate request that determines `max_fragmented_recv_size`, so the unsatisfiable-reassembly condition is set up deterministically with two packets. No race, no memory-layout grooming, no timing dependency.\nPR:N - `recv_done()` is transport-level code that runs on every data transfer message before any SMB2 session setup or credential verification, and ksmbd never validates the negotiate request's `preferred_send_size`, letting an unauthenticated peer shrink the reassembly capacity below the pre-auth `SMB3_MAX_MSGSIZE` PDU limit and wedge the connection thread with no credentials at all.\nUI:N - The server processes the malformed data transfer message automatically as part of normal SMB Direct receive completion handling. No administrator or user action on the target is involved.\nS:U - The impact is confined to the ksmbd server's own kernel context \u2014 the stalled connection thread and pinned kernel allocations \u2014 with no crossing into a different security authority such as a hypervisor or IOMMU boundary.\nC:N - With the parent commit's `data_offset`/`data_length` validation in place, every `memcpy()` source in `smb_direct_read()` stays within the DMA'd `wc->byte_len` region, so no out-of-bounds or stale buffer contents are read and nothing is disclosed to the attacker beyond data they supplied themselves.\nI:N - The unsigned overflow of `data_length + remaining_data_length` only desynchronizes RFC1002 PDU framing on a byte stream the attacker already fully controls, and `get_rfc1002_len()`'s `0xFFFFFF` mask plus the `max_allowed_pdu_size` check prevent any under-allocation or out-of-bounds write, so no kernel data or control flow is modified.\nA:H - A remote peer can request reassembly of a message larger than the transport can ever hold (bounded by 255 recvmsg buffers), permanently blocking the ksmbd connection kthread in `wait_event_interruptible()` while it pins a multi-megabyte `kvmalloc` buffer and the entire receive buffer pool; repeating this across connections exhausts kernel memory and server threads, denying SMB service."
    }
  }
}
