]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
accel/ivpu: Validate scatter-gather size against buffer size
authorKarol Wachowski <karol.wachowski@linux.intel.com>
Mon, 15 Dec 2025 07:09:33 +0000 (08:09 +0100)
committerKarol Wachowski <karol.wachowski@linux.intel.com>
Tue, 16 Dec 2025 07:10:19 +0000 (08:10 +0100)
commit2359fe93138d80ca378072d4c743b8c17612f3e3
tree5a4d3340be6ea8a9fd5f57961621faa522f61d1a
parent97f27573837ef96b4ba42af463cc800cab615c0e
accel/ivpu: Validate scatter-gather size against buffer size

Validate scatter-gather table size matches buffer object size before
mapping. Break mapping early if the table exceeds buffer size to
prevent overwriting existing mappings. Also validate the table is
not smaller than buffer size to avoid unmapped regions that trigger
MMU translation faults.

Log error and fail mapping operation on size mismatch to prevent
data corruption from mismatched host memory locations and NPU
addresses. Unmap any partially mapped buffer on failure.

Reviewed-by: Lizhi Hou <lizhi.hou@amd.com>
Signed-off-by: Karol Wachowski <karol.wachowski@linux.intel.com>
Link: https://patch.msgid.link/20251215070933.520377-1-karol.wachowski@linux.intel.com
drivers/accel/ivpu/ivpu_gem.c
drivers/accel/ivpu/ivpu_mmu_context.c
drivers/accel/ivpu/ivpu_mmu_context.h