Skip to contentSkip to conversation

drm/amdkfd: fix the clean up when amdgpu_hmm_range_alloc fails

PATCH Superseded Sunil Khatri 1 participant 1 message Oct 24, 2025

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdkfd: fix the clean up when amdgpu_hmm_range_alloc fails

we need to unreserve the bo's too during clean up along with freeing the memory of context.

Fixes c549912cd8 (drm/amdkfd: add missing return value check for range)
---
 drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdkfd/kfd_svm.c +1 -0
index 7f0ab73e2396..1b8d284dd15d 100644
@@ -1740,6 +1740,7 @@ static int svm_range_validate_and_map(struct mm_struct *mm,
 			range = amdgpu_hmm_range_alloc(NULL);
 			if (unlikely(!range)) {
 				r = -ENOMEM;
+				svm_range_unreserve_bos(ctx);
 				goto free_ctx;
 			}
 
Signature · 1 line
2.34.1