From patchwork Tue May 16 09:30:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oded Gabbay X-Patchwork-Id: 13242817 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 47A1CC7EE24 for ; Tue, 16 May 2023 09:30:47 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 879AA10E334; Tue, 16 May 2023 09:30:44 +0000 (UTC) Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by gabe.freedesktop.org (Postfix) with ESMTPS id B1DB010E330 for ; Tue, 16 May 2023 09:30:40 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B6F8F61943; Tue, 16 May 2023 09:30:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1118DC433EF; Tue, 16 May 2023 09:30:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684229439; bh=6ZyyFG8mV1jRJa4Pov4WC5PWy4ci9vNqitLnGgu2V3U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YqgswFze4JQJ4q2shN+4+ItTAtVCZw4bYPdHh4P11eb6RYLBhnG1FigN1HmnNXlFf RDjrXpDTBSepY9QsjVZ22BsQkKDUtXp4APddFHYZrZrI7yt/6lCMd5hTH/kIK2GR3I yWr84OeN5LcF1xRblUzQKM7SKSXswFE9QBk0Yt4l4MuxpgEXvXpV61SyryrazKxtE6 OT8a6xzd/GHPfXJRfrZiM+WwvGOczmn/vBT2pzEzzDIk5TzxflByZdEd6zD/5oHhQg zLQjwvqc8lSu6RfNlE+osPjkMTQeTqf0/Gb8COoXwUyuJ7Ao4zcsmIwW6o7vqv/HLG Fo1L5mnNIAtSA== From: Oded Gabbay To: dri-devel@lists.freedesktop.org Subject: [PATCH 03/12] accel/habanalabs: fix mem leak in capture user mappings Date: Tue, 16 May 2023 12:30:21 +0300 Message-Id: <20230516093030.1220526-3-ogabbay@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230516093030.1220526-1-ogabbay@kernel.org> References: <20230516093030.1220526-1-ogabbay@kernel.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Moti Haimovski , Dani Liberman Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Moti Haimovski 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: Moti Haimovski Reviewed-by: Dani Liberman Reviewed-by: Oded Gabbay Signed-off-by: Oded Gabbay --- drivers/accel/habanalabs/common/habanalabs_drv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/accel/habanalabs/common/habanalabs_drv.c b/drivers/accel/habanalabs/common/habanalabs_drv.c index 1ec97da3dddb..70fb2df9a93b 100644 --- a/drivers/accel/habanalabs/common/habanalabs_drv.c +++ b/drivers/accel/habanalabs/common/habanalabs_drv.c @@ -13,6 +13,7 @@ #include #include +#include #define CREATE_TRACE_POINTS #include @@ -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;