lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <TYZPR01MB478461E6616835634D0718F8D5BAA@TYZPR01MB4784.apcprd01.prod.exchangelabs.com>
Date:   Wed, 22 Nov 2023 16:02:43 +0800
From:   Yaxiong Tian <iambestgod@...look.com>
To:     michael.jamet@...el.com, gregkh@...uxfoundation.org,
        andreas.noever@...il.com, mika.westerberg@...ux.intel.com,
        YehezkelShB@...il.com
Cc:     tianyaxiong@...inos.cn, linux-usb@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: [PATCH] thunderbolt:debugfs:Fix memory leak with using debugfs_lookup()

From: Yaxiong Tian <tianyaxiong@...inos.cn>

As Greg said,When calling debugfs_lookup() the result must have dput()
called on it,otherwise the memory will leak over time.
So just call debugfs_lookup_and_remove() instead.

Fixes: d0f1e0c2a699 ("thunderbolt: Add support for receiver lane margining")
Signed-off-by: Yaxiong Tian <tianyaxiong@...inos.cn>
---
 drivers/thunderbolt/debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/thunderbolt/debugfs.c b/drivers/thunderbolt/debugfs.c
index c9ddd49138d8..e324cd899719 100644
--- a/drivers/thunderbolt/debugfs.c
+++ b/drivers/thunderbolt/debugfs.c
@@ -959,7 +959,7 @@ static void margining_port_remove(struct tb_port *port)
 	snprintf(dir_name, sizeof(dir_name), "port%d", port->port);
 	parent = debugfs_lookup(dir_name, port->sw->debugfs_dir);
 	if (parent)
-		debugfs_remove_recursive(debugfs_lookup("margining", parent));
+		debugfs_lookup_and_remove("margining", parent);
 
 	kfree(port->usb4->margining);
 	port->usb4->margining = NULL;
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ