{
  "schema_version": "1.6.1",
  "id": "RPI-CVE-2024-26748",
  "modified": "2026-10-09T11:39:44Z",
  "upstream": [
    "CVE-2024-26748"
  ],
  "published": "2024-04-03T17:31:22Z",
  "summary": "usb: cdns3: fix memory double free when handle zero packet",
  "details": "In the Linux kernel, the following vulnerability has been resolved:\n\nusb: cdns3: fix memory double free when handle zero packet\n\n829  if (request->complete) {\n830          spin_unlock(&priv_dev->lock);\n831          usb_gadget_giveback_request(&priv_ep->endpoint,\n832                                    request);\n833          spin_lock(&priv_dev->lock);\n834  }\n835\n836  if (request->buf == priv_dev->zlp_buf)\n837      cdns3_gadget_ep_free_request(&priv_ep->endpoint, request);\n\nDriver append an additional zero packet request when queue a packet, which\nlength mod max packet size is 0. When transfer complete, run to line 831,\nusb_gadget_giveback_request() will free this requestion. 836 condition is\ntrue, so cdns3_gadget_ep_free_request() free this request again.\n\nLog:\n\n[ 1920.140696][  T150] BUG: KFENCE: use-after-free read in cdns3_gadget_giveback+0x134/0x2c0 [cdns3]\n[ 1920.140696][  T150]\n[ 1920.151837][  T150] Use-after-free read at 0x000000003d1cd10b (in kfence-#36):\n[ 1920.159082][  T150]  cdns3_gadget_giveback+0x134/0x2c0 [cdns3]\n[ 1920.164988][  T150]  cdns3_transfer_completed+0x438/0x5f8 [cdns3]\n\nAdd check at line 829, skip call usb_gadget_giveback_request() if it is\nadditional zero length packet request. Needn't call\nusb_gadget_giveback_request() because it is allocated in this driver.",
  "severity": [
    {
      "type": "CVSS_V3",
      "score": "CVSS:3.1/AV:L/AC:L/PR:L/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.80",
            "compiled_filter": false
          }
        }
      }
    }
  ],
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://www.cve.org/CVERecord?id=CVE-2024-26748"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/aad6132ae6e4809e375431f8defd1521985e44e7"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/1e204a8e9eb514e22a6567fb340ebb47df3f3a48"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/3a2a909942b5335b7ea66366d84261b3ed5f89c8"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/9a52b694b066f299d8b9800854a8503457a8b64c"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/70e8038813f9d3e72df966748ebbc40efe466019"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/92d20406a3d4ff3e8be667c79209dc9ed31df5b3"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/5fd9e45f1ebcd57181358af28506e8a661a260b3"
    }
  ],
  "database_specific": {
    "source": "https://git.kernel.org/pub/scm/linux/security/vulns.git",
    "upstream_modified": "2026-08-05T11:52:36Z",
    "severity": {
      "source": "kernel CNA",
      "cvss_v3_score": 7.8,
      "cvss_v3_severity": "High",
      "scenario": "AV:L - The vulnerable path is selected entirely by locally queued transfer parameters (`req->zero` plus `length % maxpacket == 0`) set by in-kernel function drivers on behalf of local userspace \u2014 USB-Ethernet/NCM tethering, the printer gadget, UVC streaming \u2014 not by anything a USB peer supplies, so no physical action by the attacker is needed on a peripheral in its normal connected operating state. This matches the AV:L treatment of the sibling cdns3 gadget flaw CVE-2024-26747.\nAC:L - The attacker fully controls the transfer length, and the ZLP request append plus the buggy giveback sequence follow deterministically; the lock-drop window around `usb_gadget_giveback_request()` is one the attacker widens at will by queuing transfers concurrently from multiple threads.\nPR:L - Once the gadget is configured (normal system state on these embedded boards), any unprivileged process can drive the path \u2014 e.g. sending a UDP datagram sized so the NCM/ECM frame is an exact multiple of the 512/1024-byte bulk-IN maxpacket over `usb0`, or writing to `/dev/g_printer0` or the UVC gadget node \u2014 with no capability check anywhere on the path.\nUI:N - No victim action is required; the affected devices operate as USB peripherals attached to a host as their normal deployed state, and the attacker triggers the flaw purely by generating traffic.\nS:U - The corruption is confined to kernel heap memory managed by the same kernel security authority; no VM, IOMMU, or sandbox boundary is crossed.\nC:H - The flaw includes a confirmed use-after-free read of a freed `struct cdns3_request` (KFENCE-reported), and the double free of a kmalloc-192 general-cache object lets an attacker reallocate it with sprayed data and have the driver disclose or act on it, enabling arbitrary kernel memory disclosure.\nI:H - Freeing a still-live request returns an in-use object to the general slab allocator while the driver continues writing into it (`request->actual`, `finished_trb`, TRB pointers, list linkage), a classic double-free/UAF write primitive leveragable for control-flow hijack and privilege escalation.\nA:H - The double free corrupts slab freelists and the endpoint request lists, reliably producing kernel oops/panic, and it can be re-triggered at will by an unprivileged local process."
    }
  }
}
