{"id":"CVE-2024-26748","state":"PUBLISHED","title":"usb: cdns3: fix memory double free when handle zero packet","description":"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.","publishedAt":"2024-04-03T17:00:35.087Z","updatedAt":"2026-08-05T11:26:59.831Z","severity":{"score":7.8,"label":"High","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","source":"Linux"},"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"7733f6c32e36ff9d7adadf40001039bf219b1cbe","status":"affected","lessThan":"aad6132ae6e4809e375431f8defd1521985e44e7","versionType":"git"},{"version":"7733f6c32e36ff9d7adadf40001039bf219b1cbe","status":"affected","lessThan":"1e204a8e9eb514e22a6567fb340ebb47df3f3a48","versionType":"git"},{"version":"7733f6c32e36ff9d7adadf40001039bf219b1cbe","status":"affected","lessThan":"3a2a909942b5335b7ea66366d84261b3ed5f89c8","versionType":"git"},{"version":"7733f6c32e36ff9d7adadf40001039bf219b1cbe","status":"affected","lessThan":"9a52b694b066f299d8b9800854a8503457a8b64c","versionType":"git"},{"version":"7733f6c32e36ff9d7adadf40001039bf219b1cbe","status":"affected","lessThan":"70e8038813f9d3e72df966748ebbc40efe466019","versionType":"git"},{"version":"7733f6c32e36ff9d7adadf40001039bf219b1cbe","status":"affected","lessThan":"92d20406a3d4ff3e8be667c79209dc9ed31df5b3","versionType":"git"},{"version":"7733f6c32e36ff9d7adadf40001039bf219b1cbe","status":"affected","lessThan":"5fd9e45f1ebcd57181358af28506e8a661a260b3","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/usb/cdns3/cdns3-gadget.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.4","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.4","versionType":"semver"},{"version":"5.4.270","status":"unaffected","lessThanOrEqual":"5.4.*","versionType":"semver"},{"version":"5.10.211","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.15.150","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"6.1.80","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.19","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.7.7","status":"unaffected","lessThanOrEqual":"6.7.*","versionType":"semver"},{"version":"6.8","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/usb/cdns3/cdns3-gadget.c"]}],"references":["https://git.kernel.org/stable/c/aad6132ae6e4809e375431f8defd1521985e44e7","https://git.kernel.org/stable/c/1e204a8e9eb514e22a6567fb340ebb47df3f3a48","https://git.kernel.org/stable/c/3a2a909942b5335b7ea66366d84261b3ed5f89c8","https://git.kernel.org/stable/c/9a52b694b066f299d8b9800854a8503457a8b64c","https://git.kernel.org/stable/c/70e8038813f9d3e72df966748ebbc40efe466019","https://git.kernel.org/stable/c/92d20406a3d4ff3e8be667c79209dc9ed31df5b3","https://git.kernel.org/stable/c/5fd9e45f1ebcd57181358af28506e8a661a260b3","https://lists.debian.org/debian-lts-announce/2024/06/msg00017.html"],"weaknesses":[],"ingestedAt":"2026-10-29T20:07:10.607Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2024/26xxx/CVE-2024-26748.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2024-26748","state":"PUBLISHED","datePublished":"2024-04-03T17:00:35.087Z","dateUpdated":"2026-08-05T11:26:59.831Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2024-02-19T14:20:24.168Z"},"containers":{"cna":{"title":"usb: cdns3: fix memory double free when handle zero packet","descriptions":[{"lang":"en","value":"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."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"7733f6c32e36ff9d7adadf40001039bf219b1cbe","status":"affected","lessThan":"aad6132ae6e4809e375431f8defd1521985e44e7","versionType":"git"},{"version":"7733f6c32e36ff9d7adadf40001039bf219b1cbe","status":"affected","lessThan":"1e204a8e9eb514e22a6567fb340ebb47df3f3a48","versionType":"git"},{"version":"7733f6c32e36ff9d7adadf40001039bf219b1cbe","status":"affected","lessThan":"3a2a909942b5335b7ea66366d84261b3ed5f89c8","versionType":"git"},{"version":"7733f6c32e36ff9d7adadf40001039bf219b1cbe","status":"affected","lessThan":"9a52b694b066f299d8b9800854a8503457a8b64c","versionType":"git"},{"version":"7733f6c32e36ff9d7adadf40001039bf219b1cbe","status":"affected","lessThan":"70e8038813f9d3e72df966748ebbc40efe466019","versionType":"git"},{"version":"7733f6c32e36ff9d7adadf40001039bf219b1cbe","status":"affected","lessThan":"92d20406a3d4ff3e8be667c79209dc9ed31df5b3","versionType":"git"},{"version":"7733f6c32e36ff9d7adadf40001039bf219b1cbe","status":"affected","lessThan":"5fd9e45f1ebcd57181358af28506e8a661a260b3","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/usb/cdns3/cdns3-gadget.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"5.4","status":"affected"},{"version":"0","status":"unaffected","lessThan":"5.4","versionType":"semver"},{"version":"5.4.270","status":"unaffected","lessThanOrEqual":"5.4.*","versionType":"semver"},{"version":"5.10.211","status":"unaffected","lessThanOrEqual":"5.10.*","versionType":"semver"},{"version":"5.15.150","status":"unaffected","lessThanOrEqual":"5.15.*","versionType":"semver"},{"version":"6.1.80","status":"unaffected","lessThanOrEqual":"6.1.*","versionType":"semver"},{"version":"6.6.19","status":"unaffected","lessThanOrEqual":"6.6.*","versionType":"semver"},{"version":"6.7.7","status":"unaffected","lessThanOrEqual":"6.7.*","versionType":"semver"},{"version":"6.8","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/usb/cdns3/cdns3-gadget.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/aad6132ae6e4809e375431f8defd1521985e44e7"},{"url":"https://git.kernel.org/stable/c/1e204a8e9eb514e22a6567fb340ebb47df3f3a48"},{"url":"https://git.kernel.org/stable/c/3a2a909942b5335b7ea66366d84261b3ed5f89c8"},{"url":"https://git.kernel.org/stable/c/9a52b694b066f299d8b9800854a8503457a8b64c"},{"url":"https://git.kernel.org/stable/c/70e8038813f9d3e72df966748ebbc40efe466019"},{"url":"https://git.kernel.org/stable/c/92d20406a3d4ff3e8be667c79209dc9ed31df5b3"},{"url":"https://git.kernel.org/stable/c/5fd9e45f1ebcd57181358af28506e8a661a260b3"}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","baseScore":7.8,"baseSeverity":"HIGH"},"scenarios":[{"lang":"en","value":"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 — USB-Ethernet/NCM tethering, the printer gadget, UVC streaming — 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 — 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 — 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."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-08-05T11:26:59.831Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.4","versionEndExcluding":"5.4.270"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.4","versionEndExcluding":"5.10.211"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.4","versionEndExcluding":"5.15.150"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.4","versionEndExcluding":"6.1.80"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.4","versionEndExcluding":"6.6.19"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.4","versionEndExcluding":"6.7.7"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"5.4","versionEndExcluding":"6.8"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}},"adp":[{"title":"CISA ADP Vulnrichment","metrics":[{"other":{"type":"ssvc","content":{"id":"CVE-2024-26748","role":"CISA Coordinator","options":[{"Exploitation":"none"},{"Automatable":"no"},{"Technical Impact":"partial"}],"version":"2.0.3","timestamp":"2024-04-05T17:31:00.230088Z"}}}],"providerMetadata":{"shortName":"CISA-ADP","orgId":"134c704f-9b21-4f2e-91b3-4a467353bcc0","dateUpdated":"2024-06-04T17:49:02.965Z"}},{"title":"CVE Program Container","references":[{"url":"https://git.kernel.org/stable/c/aad6132ae6e4809e375431f8defd1521985e44e7","tags":["x_transferred"]},{"url":"https://git.kernel.org/stable/c/1e204a8e9eb514e22a6567fb340ebb47df3f3a48","tags":["x_transferred"]},{"url":"https://git.kernel.org/stable/c/3a2a909942b5335b7ea66366d84261b3ed5f89c8","tags":["x_transferred"]},{"url":"https://git.kernel.org/stable/c/9a52b694b066f299d8b9800854a8503457a8b64c","tags":["x_transferred"]},{"url":"https://git.kernel.org/stable/c/70e8038813f9d3e72df966748ebbc40efe466019","tags":["x_transferred"]},{"url":"https://git.kernel.org/stable/c/92d20406a3d4ff3e8be667c79209dc9ed31df5b3","tags":["x_transferred"]},{"url":"https://git.kernel.org/stable/c/5fd9e45f1ebcd57181358af28506e8a661a260b3","tags":["x_transferred"]},{"url":"https://lists.debian.org/debian-lts-announce/2024/06/msg00017.html","tags":["x_transferred"]}],"providerMetadata":{"shortName":"CVE","orgId":"af854a3a-2127-422b-91ae-364da2661108","dateUpdated":"2024-08-02T00:14:13.207Z"}}]}}}