Skip to content

Commit

Permalink
thunderbolt: Fix memory leak in margining_port_remove()
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Yaxiong Tian authored and westeri committed Nov 27, 2023
1 parent 2cc14f5 commit ac43c91
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/thunderbolt/debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ac43c91

Please sign in to comment.