drm/amdgpu: fix amdgpu_cs_p1_user_fence
authorChristian König <christian.koenig@amd.com>
Fri, 25 Aug 2023 13:28:00 +0000 (15:28 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 31 Aug 2023 20:39:28 +0000 (16:39 -0400)
commita5492fe27ff9684d901b2829584ea186fbecd71e
tree40e516dc835203ce7ead2105627e4177caee516a
parent90bcb9b595549d75fca573a22f06b05ee15117fa
drm/amdgpu: fix amdgpu_cs_p1_user_fence

The offset is just 32bits here so this can potentially overflow if
somebody specifies a large value. Instead reduce the size to calculate
the last possible offset.

The error handling path incorrectly drops the reference to the user
fence BO resulting in potential reference count underflow.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c