KernelScan.io

HIGH Introduced in 6.19

dma-buf PhysVec Overflow

CVE-2026-98242

CVSS 7.7 / 10.0 KernelScan AI

CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

01

In the Linux kernel, the following vulnerability has been resolved: dma-buf: Fix silent overflow for phys vec to sgt In case MMIO size is bigger than 4G and peer2peer DMA goes through host bridge, we trigger a code path that assigns the total linked IOVA (which is greater than 4G) to mapped_len. Previously, `mapped_len` was declared as 32-bit `unsigned int`. When accumulating `size_t` lengths, this leads to a silent wrap-around. This truncation causes truncated lengths to be passed to functions like `fill_sg_entry()`. Fix this by changing `mapped_len` to `size_t` (64-bit). While at it, fix similar potential overflow issues in `calc_sg_nents` by using `check_add_overflow()` for `nents` and using `unsigned int` for the loop iterator in `fill_sg_entry` to match.

02

Engine v0.7.0

Risk summary

A local process with access to a PCI device (typically via VFIO passthrough to a VM or container) can trigger a silent integer overflow in the dma-buf subsystem when the device's MMIO region exceeds 4 GB. The overflow causes an undersized scatter-gather table to be allocated and then overwritten out of bounds, leading to kernel memory corruption that may permit arbitrary code execution or a system crash.

Affecteddrivers/dma-buf/dma-buf-mapping.c (dma-buf subsystem)

Vulnerability analysis

The kernel's dma-buf logic for mapping PCI device memory into scatter-gather tables tracks the total size of the mapped region using a variable that is too small. When a device has a memory region larger than 4 GB, the total wraps around silently, causing later steps to use truncated sizes. The count of table entries can also overflow, leading to a table that is too small being allocated and then overwritten beyond its bounds. The fix uses a sufficiently wide variable for the total size and checks for overflow when adding up entry counts, so that an oversized request fails safely instead of corrupting memory. Any local user or guest that can perform peer-to-peer DMA through the host bridge — such as a virtual machine with a passed-through PCI device or a container given device access — can reach this path if the device exposes more than 4 GB of memory-mapped space.

03

BranchIntroducedFixed inPatch commit
7.26.197.2.86b98fd7106d4
mainline6.197.3b344ca94e8cc