]> git.ipfire.org Git - thirdparty/linux.git/commit
drm/amdgpu/userq: fix memory leak in MQD creation error paths
authorJunrui Luo <moonafterrain@outlook.com>
Sat, 14 Mar 2026 15:33:53 +0000 (23:33 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 30 Mar 2026 18:36:19 +0000 (14:36 -0400)
commit27f5ff9e4a4150d7cf8b4085aedd3b77ddcc5d08
tree78f9913387443c236a703092f896fe9dd1b61b05
parent998d6781410de1c4b787fdbf6c56e851ea7fa553
drm/amdgpu/userq: fix memory leak in MQD creation error paths

In mes_userq_mqd_create(), the memdup_user() allocations for
IP-specific MQD structs are not freed when subsequent VA validation
fails. The goto free_mqd label only cleans up the MQD BO object and
userq_props.

Fix by adding kfree() before each goto free_mqd on VA validation
failure in the COMPUTE, GFX, and SDMA branches.

Fixes: 9e46b8bb0539 ("drm/amdgpu: validate userq buffer virtual address and size")
Reported-by: Yuhao Jiang <danisjiang@gmail.com>
Signed-off-by: Junrui Luo <moonafterrain@outlook.com>
Reviewed-by: Prike Liang <Prike.Liang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/mes_userqueue.c