[PATCH 5/7] habanalabs: wrong handle removal in memory manager

From: Oded Gabbay
Date: Fri Apr 01 2022 - 08:20:41 EST


From: Yuri Nudelman <ynudelman@xxxxxxxxx>

During the unified memory manager release, a wrong id was used to remove
an entry from the idr.

Signed-off-by: Yuri Nudelman <ynudelman@xxxxxxxxx>
Reviewed-by: Oded Gabbay <ogabbay@xxxxxxxxxx>
Signed-off-by: Oded Gabbay <ogabbay@xxxxxxxxxx>
---
drivers/misc/habanalabs/common/memory_mgr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/habanalabs/common/memory_mgr.c b/drivers/misc/habanalabs/common/memory_mgr.c
index 3828ba44c660..a1f499a1519c 100644
--- a/drivers/misc/habanalabs/common/memory_mgr.c
+++ b/drivers/misc/habanalabs/common/memory_mgr.c
@@ -48,7 +48,7 @@ static void hl_mmap_mem_buf_release(struct kref *kref)
container_of(kref, struct hl_mmap_mem_buf, refcount);

spin_lock(&buf->mmg->lock);
- idr_remove(&buf->mmg->handles, buf->handle);
+ idr_remove(&buf->mmg->handles, lower_32_bits(buf->handle >> PAGE_SHIFT));
spin_unlock(&buf->mmg->lock);

if (buf->ops->release)
--
2.25.1