Skip to contentSkip to conversation

habanalabs: free host huge va_range if not used

PATCH New Oded Gabbay 1 participant 1 message Nov 28, 2020 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 habanalabs: free host huge va_range if not used

From: Ofir Bitton <[email protected]>

If huge range is not valid, driver uses the host range also for huge page allocations, but driver never frees its allocation. This introduces a memory leak every time a user closes its context.

---
 drivers/misc/habanalabs/common/memory.c | 1 +
 1 file changed, 1 insertion(+)
drivers/misc/habanalabs/common/memory.c +1 -0
index 84227819e4d1..bfe223abf142 100644
@@ -1626,6 +1626,7 @@ static int vm_ctx_init_with_ranges(struct hl_ctx *ctx,
 			goto host_hpage_range_err;
 		}
 	} else {
+		kfree(ctx->host_huge_va_range);
 		ctx->host_huge_va_range = ctx->host_va_range;
 	}
 
Signature · 1 line
2.17.1