Skip to content

Commit 209cdbd

Browse files
committed
misc: vmw_balloon: fix memory leak with using debugfs_lookup()
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. Cc: Nadav Amit <namit@vmware.com> Cc: VMware PV-Drivers Reviewers <pv-drivers@vmware.com> Cc: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/r/20230202141100.2291188-1-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 1dc7e37 commit 209cdbd

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/misc/vmw_balloon.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1709,7 +1709,7 @@ static void __init vmballoon_debugfs_init(struct vmballoon *b)
17091709
static void __exit vmballoon_debugfs_exit(struct vmballoon *b)
17101710
{
17111711
static_key_disable(&balloon_stat_enabled.key);
1712-
debugfs_remove(debugfs_lookup("vmmemctl", NULL));
1712+
debugfs_lookup_and_remove("vmmemctl", NULL);
17131713
kfree(b->stats);
17141714
b->stats = NULL;
17151715
}

0 commit comments

Comments
 (0)