diff options
| author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-02-02 16:32:25 +0100 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-03-11 13:57:35 +0100 |
| commit | c6af1dbc99ad37bf67c8703982df4d7f12d256c1 (patch) | |
| tree | b3275b4d1e5938f28fe895f71e89e92fae56d69f | |
| parent | 4322661af6d7a586a5798ab9aa443f49895b6943 (diff) | |
| download | linux-c6af1dbc99ad37bf67c8703982df4d7f12d256c1.tar.gz linux-c6af1dbc99ad37bf67c8703982df4d7f12d256c1.tar.bz2 linux-c6af1dbc99ad37bf67c8703982df4d7f12d256c1.zip | |
USB: uhci: fix memory leak with using debugfs_lookup()
[ Upstream commit 0a3f82c79c86278e7f144564b1cb6cc5c3657144 ]
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: Alan Stern <stern@rowland.harvard.edu>
Link: https://lore.kernel.org/r/20230202153235.2412790-3-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/host/uhci-hcd.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c index d90b869f5f40..d138f62ce84d 100644 --- a/drivers/usb/host/uhci-hcd.c +++ b/drivers/usb/host/uhci-hcd.c @@ -536,8 +536,8 @@ static void release_uhci(struct uhci_hcd *uhci) uhci->is_initialized = 0; spin_unlock_irq(&uhci->lock); - debugfs_remove(debugfs_lookup(uhci_to_hcd(uhci)->self.bus_name, - uhci_debugfs_root)); + debugfs_lookup_and_remove(uhci_to_hcd(uhci)->self.bus_name, + uhci_debugfs_root); for (i = 0; i < UHCI_NUM_SKELQH; i++) uhci_free_qh(uhci, uhci->skelqh[i]); @@ -700,7 +700,7 @@ err_alloc_frame_cpu: uhci->frame, uhci->frame_dma_handle); err_alloc_frame: - debugfs_remove(debugfs_lookup(hcd->self.bus_name, uhci_debugfs_root)); + debugfs_lookup_and_remove(hcd->self.bus_name, uhci_debugfs_root); return retval; } |
