Skip to content
Commit be308d68 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

USB: dwc3: 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.

Note, the root dentry for the debugfs directory for the device needs to
be saved so we don't have to keep looking it up, which required a bit
more refactoring to properly create and remove it when needed.

Reported-by: default avatarBruce Chen <bruce.chen@unisoc.com>
Reported-by: default avatarCixi Geng <cixi.geng1@unisoc.com>
Tested-by: default avatarCixi Geng <gengcixi@gmail.com>
Acked-by: default avatarThinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/20230202152820.2409908-1-gregkh@linuxfoundation.org


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 25746a3f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment