From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2046AC7EE2F for ; Sun, 26 Feb 2023 14:56:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231204AbjBZO4P (ORCPT ); Sun, 26 Feb 2023 09:56:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230220AbjBZOyO (ORCPT ); Sun, 26 Feb 2023 09:54:14 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6960EAD2E; Sun, 26 Feb 2023 06:50:25 -0800 (PST) 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 C104660C17; Sun, 26 Feb 2023 14:46:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE986C4339B; Sun, 26 Feb 2023 14:46:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1677422787; bh=CYx/ymQhQfmjFox7JL4R9cjKSnWB/RkxeJDytUG4sGQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IZVQj2NXeW+nSFzTc/a31WCL/0qD2EPbGHcYCMKzlJTO/pMljZGO9NpSVoARxfvrR VCiLgqoR2MU7hIk1JUlvRi8RD+jIb/MeWrHhWNurnuG4WZwfVRWRElywYsfuxX1Wk7 WIMhIKt2+NNqMSUvPaYRCg7ZqRN7uY0E+I9MhQEaClXl3SG47c4xEiN5cpDblQoECd nv/pzCqVQTK1jaNFTXxxFQXV2Ynv6kO6iRmUjye/yhpnAEn0mv6pYGNk7yjquwfoht ICJWF0ovkuq+SrkZlerF9cG60hCeIRUJJXE1xsRYLUOdheVCPLtGX+7IblviRYMmqa ZrlERMCX3CASA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Thomas Gleixner , Sasha Levin Subject: [PATCH AUTOSEL 6.2 42/53] time/debug: Fix memory leak with using debugfs_lookup() Date: Sun, 26 Feb 2023 09:44:34 -0500 Message-Id: <20230226144446.824580-42-sashal@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230226144446.824580-1-sashal@kernel.org> References: <20230226144446.824580-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Greg Kroah-Hartman [ Upstream commit 5b268d8abaec6cbd4bd70d062e769098d96670aa ] When calling debugfs_lookup() the result must have dput() called on it, otherwise the memory will leak over time. To make things simpler, just call debugfs_lookup_and_remove() instead which handles all of the logic at once. Signed-off-by: Greg Kroah-Hartman Signed-off-by: Thomas Gleixner Link: https://lore.kernel.org/r/20230202151214.2306822-1-gregkh@linuxfoundation.org Signed-off-by: Sasha Levin --- kernel/time/test_udelay.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/time/test_udelay.c b/kernel/time/test_udelay.c index 13b11eb62685e..20d5df631570e 100644 --- a/kernel/time/test_udelay.c +++ b/kernel/time/test_udelay.c @@ -149,7 +149,7 @@ module_init(udelay_test_init); static void __exit udelay_test_exit(void) { mutex_lock(&udelay_test_lock); - debugfs_remove(debugfs_lookup(DEBUGFS_FILENAME, NULL)); + debugfs_lookup_and_remove(DEBUGFS_FILENAME, NULL); mutex_unlock(&udelay_test_lock); } -- 2.39.0