From nobody Thu Apr 9 05:24:52 2026 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 7AC49C61DA4 for ; Thu, 2 Feb 2023 15:12:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231905AbjBBPM5 (ORCPT ); Thu, 2 Feb 2023 10:12:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231827AbjBBPMy (ORCPT ); Thu, 2 Feb 2023 10:12:54 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F738945D6 for ; Thu, 2 Feb 2023 07:12:28 -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 8B58D61BC5 for ; Thu, 2 Feb 2023 15:12:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9CC70C433D2; Thu, 2 Feb 2023 15:12:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1675350739; bh=RxwsXdM5vF3QKbjv+va1tNRqLPUWeljily2y8yLNGOo=; h=From:To:Cc:Subject:Date:From; b=XxumIkuCc2EZQtiPTNUlcP8o/DgVsbV+UzZXRLKqsR70Dx5F6dWknhct4v8PGSERh 3Sd1uorAhu5dTJv7LUI+ba4Q7mMT1JtCpH5fMTmneKhikdXhkxqdwvu88yu/Rwsftf mSlDfbEjRghmjhFrx4rr19E/ErS9disUDmGK02yM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman Subject: [PATCH] kernel/time/test_udelay.c: fix memory leak with using debugfs_lookup() Date: Thu, 2 Feb 2023 16:12:14 +0100 Message-Id: <20230202151214.2306822-1-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=863; i=gregkh@linuxfoundation.org; h=from:subject; bh=RxwsXdM5vF3QKbjv+va1tNRqLPUWeljily2y8yLNGOo=; b=owGbwMvMwCRo6H6F97bub03G02pJDMm3L50yYwrXs1PIlzNsn/63MZnp79Put7ffFqz7x9MnFmie M02zI5aFQZCJQVZMkeXLNp6j+ysOKXoZ2p6GmcPKBDKEgYtTACai8pRhrqj+6v7U6nylqZ9PxfrnWC Tq3lrVyzA/6OCUPbu5vT89VHyla/o+Lf4N1/aXAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 --- 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 13b11eb62685..20d5df631570 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); } =20 --=20 2.39.1