public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH next] drm/amdgpu: unlock and cleanup on error in amdgpu_cs_parser_bos()
@ 2025-10-22 11:02 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2025-10-22 11:02 UTC (permalink / raw)
  To: Sunil Khatri
  Cc: Alex Deucher, Christian König, David Airlie, Simona Vetter,
	Srinivasan Shanmugam, Liu01 Tong, Tvrtko Ursulin,
	Mario Limonciello, amd-gfx, dri-devel, linux-kernel,
	kernel-janitors

If amdgpu_hmm_range_alloc() fails then free the previous iterations and
call mutex_unlock(&p->bo_list->bo_list_mutex) before returning.

Fixes: e095b55155ef ("drm/amdgpu: use user provided hmm_range buffer in amdgpu_ttm_tt_get_user_pages")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
index ecdfe6cb36cc..dac0b15823f2 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
@@ -892,8 +892,10 @@ 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))
-			return -ENOMEM;
+		if (unlikely(!e->range)) {
+			r = -ENOMEM;
+			goto out_free_user_pages;
+		}
 
 		r = amdgpu_ttm_tt_get_user_pages(bo, e->range);
 		if (r)
-- 
2.51.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2025-10-22 11:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-22 11:02 [PATCH next] drm/amdgpu: unlock and cleanup on error in amdgpu_cs_parser_bos() Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox