Skip to content

Commit 6fbaeff

Browse files
Yaxiong Tiangregkh
authored andcommitted
thunderbolt: Fix memory leak in margining_port_remove()
commit ac43c91 upstream. The dentry returned by debugfs_lookup() needs to be released by calling dput() which is missing in margining_port_remove(). Fix this by calling debugfs_lookup_and_remove() that combines both and avoids the memory leak. Fixes: d0f1e0c ("thunderbolt: Add support for receiver lane margining") Cc: stable@vger.kernel.org Signed-off-by: Yaxiong Tian <tianyaxiong@kylinos.cn> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 50ae1c4 commit 6fbaeff

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/thunderbolt/debugfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -959,7 +959,7 @@ static void margining_port_remove(struct tb_port *port)
959959
snprintf(dir_name, sizeof(dir_name), "port%d", port->port);
960960
parent = debugfs_lookup(dir_name, port->sw->debugfs_dir);
961961
if (parent)
962-
debugfs_remove_recursive(debugfs_lookup("margining", parent));
962+
debugfs_lookup_and_remove("margining", parent);
963963

964964
kfree(port->usb4->margining);
965965
port->usb4->margining = NULL;

0 commit comments

Comments
 (0)