diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-02-02 18:28:20 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-03-11 15:55:36 +0300 |
commit | ce234af49d103d95e3fdca59b25e0d0242f41bb4 (patch) | |
tree | 26f5cf13e08ed109ddebf54d51113a90a6491981 /drivers/usb/chipidea/debug.c | |
parent | 04f3cda40e9f6653ae15ed3fcf26ef2860f4df66 (diff) | |
download | linux-ce234af49d103d95e3fdca59b25e0d0242f41bb4.tar.xz |
USB: dwc3: fix memory leak with using debugfs_lookup()
[ Upstream commit be308d68785b205e483b3a0c61ba3a82da468f2c ]
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: Bruce Chen <bruce.chen@unisoc.com>
Reported-by: Cixi Geng <cixi.geng1@unisoc.com>
Tested-by: Cixi Geng <gengcixi@gmail.com>
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/20230202152820.2409908-1-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/usb/chipidea/debug.c')
0 files changed, 0 insertions, 0 deletions