On 04-02-2026 02:32 pm, Christian König wrote:
On 2/3/26 07:55, Sunil Khatri wrote:
In low memory conditions when kmalloc can fail and hence
we need to clean up the memory and unlock the mutex for
clean exit.
Fixes: 737da5363cc0 ("drm/amdgpu: update the functions to use amdgpu version of
hmm")
Reported-by: kernel test robot <[email protected]>
Reported-by: Dan Carpenter <[email protected]>
Closes: https://lore.kernel.org/r/[email protected]/
Signed-off-by: Sunil Khatri <[email protected]>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index d591dce0f3b3..831063971f71 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -892,8 +892,11 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
struct amdgpu_bo *bo = e->bo;
e->range = amdgpu_hmm_range_alloc(NULL);
- if (unlikely(!e->range))
+ if (unlikely(!e->range)) {
+ mutex_unlock(&p->bo_list->bo_list_mutex);
+ amdgpu_bo_list_put(p->bo_list)
The call to amdgpu_bo_list_put() is always done by amdgpu_cs_parser_fini(), so
that here would drop the reference twice.
Ah yes, i dint realise it is freed in the parent function. Pushed V5
with final change as expected.
Thanks
Sunil
Apart from that looks correct to me.
Regards,
Christian.
return -ENOMEM;
+ }
r = amdgpu_ttm_tt_get_user_pages(bo, e->range);
if (r)