{"id":"CVE-2025-38224","state":"PUBLISHED","title":"can: kvaser_pciefd: refine error prone echo_skb_max handling logic","description":"In the Linux kernel, the following vulnerability has been resolved:\n\ncan: kvaser_pciefd: refine error prone echo_skb_max handling logic\n\necho_skb_max should define the supported upper limit of echo_skb[]\nallocated inside the netdevice's priv. The corresponding size value\nprovided by this driver to alloc_candev() is KVASER_PCIEFD_CAN_TX_MAX_COUNT\nwhich is 17.\n\nBut later echo_skb_max is rounded up to the nearest power of two (for the\nmax case, that would be 32) and the tx/ack indices calculated further\nduring tx/rx may exceed the upper array boundary. Kasan reported this for\nthe ack case inside kvaser_pciefd_handle_ack_packet(), though the xmit\nfunction has actually caught the same thing earlier.\n\n BUG: KASAN: slab-out-of-bounds in kvaser_pciefd_handle_ack_packet+0x2d7/0x92a drivers/net/can/kvaser_pciefd.c:1528\n Read of size 8 at addr ffff888105e4f078 by task swapper/4/0\n\n CPU: 4 UID: 0 PID: 0 Comm: swapper/4 Not tainted 6.15.0 #12 PREEMPT(voluntary)\n Call Trace:\n  <IRQ>\n dump_stack_lvl lib/dump_stack.c:122\n print_report mm/kasan/report.c:521\n kasan_report mm/kasan/report.c:634\n kvaser_pciefd_handle_ack_packet drivers/net/can/kvaser_pciefd.c:1528\n kvaser_pciefd_read_packet drivers/net/can/kvaser_pciefd.c:1605\n kvaser_pciefd_read_buffer drivers/net/can/kvaser_pciefd.c:1656\n kvaser_pciefd_receive_irq drivers/net/can/kvaser_pciefd.c:1684\n kvaser_pciefd_irq_handler drivers/net/can/kvaser_pciefd.c:1733\n __handle_irq_event_percpu kernel/irq/handle.c:158\n handle_irq_event kernel/irq/handle.c:210\n handle_edge_irq kernel/irq/chip.c:833\n __common_interrupt arch/x86/kernel/irq.c:296\n common_interrupt arch/x86/kernel/irq.c:286\n  </IRQ>\n\nTx max count definitely matters for kvaser_pciefd_tx_avail(), but for seq\nnumbers' generation that's not the case - we're free to calculate them as\nwould be more convenient, not taking tx max count into account. The only\ndownside is that the size of echo_skb[] should correspond to the max seq\nnumber (not tx max count), so in some situations a bit more memory would\nbe consumed than could be.\n\nThus make the size of the underlying echo_skb[] sufficient for the rounded\nmax tx value.\n\nFound by Linux Verification Center (linuxtesting.org) with Syzkaller.","publishedAt":"2025-07-04T13:37:39.305Z","updatedAt":"2026-08-05T12:00:27.874Z","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":"352fbde14177d608a54120b6ff559ce5b3cf6238","status":"affected","lessThan":"d8a054b6e6824a8b52c3977ebd38c9583a63efac","versionType":"git"},{"version":"8256e0ca601051933e9395746817f3801fa9a6bf","status":"affected","lessThan":"a6550c9aa11e2f57f9cdaa6249cdd44d446be874","versionType":"git"},{"version":"8256e0ca601051933e9395746817f3801fa9a6bf","status":"affected","lessThan":"54ec8b08216f3be2cc98b33633d3c8ea79749895","versionType":"git"},{"version":"f14512f3ee09cda986191c8dd7f54972afa2c763","status":"affected","versionType":"git"},{"version":"6.12.31","status":"affected","lessThan":"6.12.35","versionType":"semver"},{"version":"6.14.9","status":"affected","lessThan":"6.15","versionType":"semver"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/net/can/kvaser_pciefd.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.15","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.15","versionType":"semver"},{"version":"6.12.35","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.15.4","status":"unaffected","lessThanOrEqual":"6.15.*","versionType":"semver"},{"version":"6.16","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/net/can/kvaser_pciefd.c"]}],"references":["https://git.kernel.org/stable/c/d8a054b6e6824a8b52c3977ebd38c9583a63efac","https://git.kernel.org/stable/c/a6550c9aa11e2f57f9cdaa6249cdd44d446be874","https://git.kernel.org/stable/c/54ec8b08216f3be2cc98b33633d3c8ea79749895"],"weaknesses":[],"ingestedAt":"2026-10-29T20:09:09.358Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2025/38xxx/CVE-2025-38224.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2025-38224","state":"PUBLISHED","datePublished":"2025-07-04T13:37:39.305Z","dateUpdated":"2026-08-05T12:00:27.874Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2025-04-16T04:51:23.995Z"},"containers":{"cna":{"title":"can: kvaser_pciefd: refine error prone echo_skb_max handling logic","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\ncan: kvaser_pciefd: refine error prone echo_skb_max handling logic\n\necho_skb_max should define the supported upper limit of echo_skb[]\nallocated inside the netdevice's priv. The corresponding size value\nprovided by this driver to alloc_candev() is KVASER_PCIEFD_CAN_TX_MAX_COUNT\nwhich is 17.\n\nBut later echo_skb_max is rounded up to the nearest power of two (for the\nmax case, that would be 32) and the tx/ack indices calculated further\nduring tx/rx may exceed the upper array boundary. Kasan reported this for\nthe ack case inside kvaser_pciefd_handle_ack_packet(), though the xmit\nfunction has actually caught the same thing earlier.\n\n BUG: KASAN: slab-out-of-bounds in kvaser_pciefd_handle_ack_packet+0x2d7/0x92a drivers/net/can/kvaser_pciefd.c:1528\n Read of size 8 at addr ffff888105e4f078 by task swapper/4/0\n\n CPU: 4 UID: 0 PID: 0 Comm: swapper/4 Not tainted 6.15.0 #12 PREEMPT(voluntary)\n Call Trace:\n  <IRQ>\n dump_stack_lvl lib/dump_stack.c:122\n print_report mm/kasan/report.c:521\n kasan_report mm/kasan/report.c:634\n kvaser_pciefd_handle_ack_packet drivers/net/can/kvaser_pciefd.c:1528\n kvaser_pciefd_read_packet drivers/net/can/kvaser_pciefd.c:1605\n kvaser_pciefd_read_buffer drivers/net/can/kvaser_pciefd.c:1656\n kvaser_pciefd_receive_irq drivers/net/can/kvaser_pciefd.c:1684\n kvaser_pciefd_irq_handler drivers/net/can/kvaser_pciefd.c:1733\n __handle_irq_event_percpu kernel/irq/handle.c:158\n handle_irq_event kernel/irq/handle.c:210\n handle_edge_irq kernel/irq/chip.c:833\n __common_interrupt arch/x86/kernel/irq.c:296\n common_interrupt arch/x86/kernel/irq.c:286\n  </IRQ>\n\nTx max count definitely matters for kvaser_pciefd_tx_avail(), but for seq\nnumbers' generation that's not the case - we're free to calculate them as\nwould be more convenient, not taking tx max count into account. The only\ndownside is that the size of echo_skb[] should correspond to the max seq\nnumber (not tx max count), so in some situations a bit more memory would\nbe consumed than could be.\n\nThus make the size of the underlying echo_skb[] sufficient for the rounded\nmax tx value.\n\nFound by Linux Verification Center (linuxtesting.org) with Syzkaller."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"352fbde14177d608a54120b6ff559ce5b3cf6238","status":"affected","lessThan":"d8a054b6e6824a8b52c3977ebd38c9583a63efac","versionType":"git"},{"version":"8256e0ca601051933e9395746817f3801fa9a6bf","status":"affected","lessThan":"a6550c9aa11e2f57f9cdaa6249cdd44d446be874","versionType":"git"},{"version":"8256e0ca601051933e9395746817f3801fa9a6bf","status":"affected","lessThan":"54ec8b08216f3be2cc98b33633d3c8ea79749895","versionType":"git"},{"version":"f14512f3ee09cda986191c8dd7f54972afa2c763","status":"affected","versionType":"git"},{"version":"6.12.31","status":"affected","lessThan":"6.12.35","versionType":"semver"},{"version":"6.14.9","status":"affected","lessThan":"6.15","versionType":"semver"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/net/can/kvaser_pciefd.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.15","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.15","versionType":"semver"},{"version":"6.12.35","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.15.4","status":"unaffected","lessThanOrEqual":"6.15.*","versionType":"semver"},{"version":"6.16","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/net/can/kvaser_pciefd.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/d8a054b6e6824a8b52c3977ebd38c9583a63efac"},{"url":"https://git.kernel.org/stable/c/a6550c9aa11e2f57f9cdaa6249cdd44d446be874"},{"url":"https://git.kernel.org/stable/c/54ec8b08216f3be2cc98b33633d3c8ea79749895"}],"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 out-of-bounds index is derived from the driver's own monotonically increasing `tx_idx` transmit counter, so it is reached by locally transmitting CAN frames via an AF_CAN socket (`socket`/`bind`/`sendmsg`) on the kvaser_pciefd netdev. Data received from the CAN bus never indexes `echo_skb[]`, so no adjacent/network attacker controls the offset.\nAC:L - The overflow is fully deterministic — `seq = tx_idx & 31` against a 17-entry array means the 18th frame sent lands out of bounds, with no race to win and no memory-layout condition needed to trigger it. Real Kvaser PCIe FD cards report a TX FIFO depth that makes `tx_max_count == 17`, which is exactly the case that rounds up to 32.\nPR:L - `can_create()` in net/can/af_can.c and `raw_sendmsg()` in net/can/raw.c contain no capability checks (only net/can/gw.c gates on CAP_NET_ADMIN), so any unprivileged local user can open a CAN_RAW socket and transmit. The interface being up is the normal operational state of a system fitted with a Kvaser CAN card, not an attacker-supplied precondition.\nUI:N - The attacker triggers the overflow entirely on their own by writing frames to a CAN socket; no victim action, mount, or file open is involved.\nS:U - The heap corruption occurs in kernel memory and is exploited within the same kernel security authority, with no crossing of a VM, IOMMU, or sandbox boundary.\nC:H - KASAN confirmed a slab-out-of-bounds *read* of 8 bytes at `can->can.echo_skb[echo_idx]` beyond the end of the `net_device`+priv allocation; that adjacent-heap value is then treated as an `sk_buff *` and passed through `can_skb_ext_find()`/`netif_rx()`, exposing neighbouring kernel heap contents and enabling further disclosure.\nI:H - Indices 17–31 write past the end of the whole `kvzalloc_flex()` netdev allocation — a NULL store from `start_xmit()`, a live `sk_buff` pointer store from `can_put_echo_skb()`, and another NULL store from `__can_get_echo_skb()` — giving a controlled-offset out-of-bounds write into adjacent slab objects that is leverageable for control-flow hijacking.\nA:H - The out-of-bounds access is a KASAN-reported slab overflow reached from hard IRQ context; treating adjacent heap data as an `sk_buff` and passing it to `netif_rx()`/`dev_kfree_skb_any()` reliably produces an oops or panic, and a vmalloc-backed netdev allocation hits a guard page outright."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-08-05T12:00:27.874Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.12.31","versionEndExcluding":"6.12.35"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.15","versionEndExcluding":"6.15.4"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.15","versionEndExcluding":"6.16"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.14.9"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}