mirror of
https://github.com/torvalds/linux.git
synced 2026-06-06 13:37:36 +02:00
habanalabs: Fix memleak in hl_device_reset
[ Upstream commit b000700d6d ]
When kzalloc() fails, we should execute hl_mmu_fini()
to release the MMU module. It's the same when
hl_ctx_init() fails.
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
78755373aa
commit
8c3520e21f
|
|
@ -1027,6 +1027,7 @@ int hl_device_reset(struct hl_device *hdev, bool hard_reset,
|
|||
GFP_KERNEL);
|
||||
if (!hdev->kernel_ctx) {
|
||||
rc = -ENOMEM;
|
||||
hl_mmu_fini(hdev);
|
||||
goto out_err;
|
||||
}
|
||||
|
||||
|
|
@ -1038,6 +1039,7 @@ int hl_device_reset(struct hl_device *hdev, bool hard_reset,
|
|||
"failed to init kernel ctx in hard reset\n");
|
||||
kfree(hdev->kernel_ctx);
|
||||
hdev->kernel_ctx = NULL;
|
||||
hl_mmu_fini(hdev);
|
||||
goto out_err;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user