diff options
| author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-02-02 16:32:32 +0100 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-03-11 13:57:36 +0100 |
| commit | 036ada6ca9eea926abc0b0ef550b10488d66d4d8 (patch) | |
| tree | a7611809bc5243f9754e82717398fcb7b10dc587 | |
| parent | b0a2663ecbe8f65cd3bab2b34dd90156ceb0dbb8 (diff) | |
| download | linux-036ada6ca9eea926abc0b0ef550b10488d66d4d8.tar.gz linux-036ada6ca9eea926abc0b0ef550b10488d66d4d8.tar.bz2 linux-036ada6ca9eea926abc0b0ef550b10488d66d4d8.zip | |
USB: gadget: lpc32xx_udc: fix memory leak with using debugfs_lookup()
[ Upstream commit e3965acaf3739fde9d74ad82979b46d37c6c208f ]
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: Jakob Koschel <jakobkoschel@gmail.com>
Cc: Miaoqian Lin <linmq006@gmail.com>
Acked-by: Vladimir Zapolskiy <vz@mleia.com>
Link: https://lore.kernel.org/r/20230202153235.2412790-10-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
| -rw-r--r-- | drivers/usb/gadget/udc/lpc32xx_udc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/gadget/udc/lpc32xx_udc.c b/drivers/usb/gadget/udc/lpc32xx_udc.c index 865de8db998a..ec0d3d74d66e 100644 --- a/drivers/usb/gadget/udc/lpc32xx_udc.c +++ b/drivers/usb/gadget/udc/lpc32xx_udc.c @@ -532,7 +532,7 @@ static void create_debug_file(struct lpc32xx_udc *udc) static void remove_debug_file(struct lpc32xx_udc *udc) { - debugfs_remove(debugfs_lookup(debug_filename, NULL)); + debugfs_lookup_and_remove(debug_filename, NULL); } #else |
