Skip to content

Commit ac43c91

Browse files
Yaxiong Tianwesteri
authored andcommitted
thunderbolt: Fix memory leak in margining_port_remove()
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: [email protected] Signed-off-by: Yaxiong Tian <[email protected]> Signed-off-by: Mika Westerberg <[email protected]>
1 parent 2cc14f5 commit ac43c91

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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)