]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
accel/amdxdna: Fix out-of-bounds memset in command slot handling
authorLizhi Hou <lizhi.hou@amd.com>
Tue, 17 Feb 2026 18:54:15 +0000 (10:54 -0800)
committerLizhi Hou <lizhi.hou@amd.com>
Mon, 23 Feb 2026 17:24:20 +0000 (09:24 -0800)
commit1110a949675ebd56b3f0286e664ea543f745801c
tree37a8945ceb26be0a066f9fb6134abe57b908a90f
parent07efce5a6611af6714ea3ef65694e0c8dd7e44f5
accel/amdxdna: Fix out-of-bounds memset in command slot handling

The remaining space in a command slot may be smaller than the size of
the command header. Clearing the command header with memset() before
verifying the available slot space can result in an out-of-bounds write
and memory corruption.

Fix this by moving the memset() call after the size validation.

Fixes: 3d32eb7a5ecf ("accel/amdxdna: Fix cu_idx being cleared by memset() during command setup")
Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
Link: https://patch.msgid.link/20260217185415.1781908-1-lizhi.hou@amd.com
drivers/accel/amdxdna/aie2_message.c