Commit 314a7ffd authored by Moti Haimovski's avatar Moti Haimovski Committed by Oded Gabbay
Browse files

accel/habanalabs: fix mem leak in capture user mappings



This commit fixes a memory leak caused when clearing the user_mappings
info when a new context is opened immediately after user_mapping is
captured and a hard reset is performed.

Signed-off-by: default avatarMoti Haimovski <mhaimovski@habana.ai>
Reviewed-by: default avatarDani Liberman <dliberman@habana.ai>
Reviewed-by: default avatarOded Gabbay <ogabbay@kernel.org>
Signed-off-by: default avatarOded Gabbay <ogabbay@kernel.org>
parent e715008b
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@

#include <linux/pci.h>
#include <linux/module.h>
#include <linux/vmalloc.h>

#define CREATE_TRACE_POINTS
#include <trace/events/habanalabs.h>
@@ -218,6 +219,7 @@ int hl_device_open(struct inode *inode, struct file *filp)

	hl_debugfs_add_file(hpriv);

	vfree(hdev->captured_err_info.page_fault_info.user_mappings);
	memset(&hdev->captured_err_info, 0, sizeof(hdev->captured_err_info));
	atomic_set(&hdev->captured_err_info.cs_timeout.write_enable, 1);
	hdev->captured_err_info.undef_opcode.write_enable = true;