From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Alan Stern <stern@rowland.harvard.edu>,
Sasha Levin <sashal@kernel.org>,
linux-usb@vger.kernel.org
Subject: [PATCH AUTOSEL 6.2 33/64] USB: uhci: fix memory leak with using debugfs_lookup()
Date: Fri, 3 Mar 2023 16:40:35 -0500 [thread overview]
Message-ID: <20230303214106.1446460-33-sashal@kernel.org> (raw)
In-Reply-To: <20230303214106.1446460-1-sashal@kernel.org>
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ 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>
---
drivers/usb/host/uhci-hcd.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
index c22b51af83fcb..7cdc2fa7c28fb 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 @@ static int uhci_start(struct usb_hcd *hcd)
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;
}
--
2.39.2
next prev parent reply other threads:[~2023-03-03 21:45 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-03 21:40 [PATCH AUTOSEL 6.2 01/64] IB/hfi1: Update RMT size calculation Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 02/64] iommu: Remove deferred attach check from __iommu_detach_device() Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 03/64] iommu/amd: Fix error handling for pdev_pri_ats_enable() Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 04/64] PCI/ACPI: Account for _S0W of the target bridge in acpi_pci_bridge_d3() Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 05/64] media: uvcvideo: Remove format descriptions Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 06/64] media: uvcvideo: Handle cameras with invalid descriptors Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 07/64] media: uvcvideo: Handle errors from calls to usb_string Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 08/64] media: uvcvideo: Quirk for autosuspend in Logitech B910 and C910 Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 09/64] media: uvcvideo: Silence memcpy() run-time false positive warnings Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 10/64] USB: fix memory leak with using debugfs_lookup() Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 11/64] cacheinfo: Fix shared_cpu_map to handle shared caches at different levels Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 12/64] usb: fotg210: List different variants Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 13/64] dt-bindings: usb: Add device id for Genesys Logic hub controller Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 14/64] staging: emxx_udc: Add checks for dma_alloc_coherent() Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 15/64] tty: fix out-of-bounds access in tty_driver_lookup_tty() Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 16/64] tty: serial: fsl_lpuart: disable the CTS when send break signal Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 17/64] serial: sc16is7xx: setup GPIO controller later in probe Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 18/64] mei: bus-fixup:upon error print return values of send and receive Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 19/64] parport_pc: Set up mode and ECR masks for Oxford Semiconductor devices Sasha Levin
2023-03-22 23:16 ` Maciej W. Rozycki
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 20/64] tools/iio/iio_utils:fix memory leak Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 21/64] bus: mhi: ep: Fix the debug message for MHI_PKT_TYPE_RESET_CHAN_CMD cmd Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 22/64] iio: accel: mma9551_core: Prevent uninitialized variable in mma9551_read_status_word() Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 23/64] iio: accel: mma9551_core: Prevent uninitialized variable in mma9551_read_config_word() Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 24/64] media: uvcvideo: Add GUID for BGRA/X 8:8:8:8 Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 25/64] firmware: coreboot: framebuffer: Ignore reserved pixel color bits Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 26/64] soundwire: bus_type: Avoid lockdep assert in sdw_drv_probe() Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 27/64] PCI/portdrv: Prevent LS7A Bus Master clearing on shutdown Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 28/64] PCI: loongson: Prevent LS7A MRRS increases Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 29/64] staging: pi433: fix memory leak with using debugfs_lookup() Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 30/64] USB: dwc3: " Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 31/64] USB: chipidea: " Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 32/64] USB: ULPI: " Sasha Levin
2023-03-03 21:40 ` Sasha Levin [this message]
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 34/64] USB: sl811: " Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 35/64] USB: fotg210: " Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 36/64] USB: isp116x: " Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 37/64] USB: isp1362: " Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 38/64] USB: gadget: gr_udc: " Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 39/64] USB: gadget: bcm63xx_udc: " Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 40/64] USB: gadget: lpc32xx_udc: " Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 41/64] USB: gadget: pxa25x_udc: " Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 42/64] USB: gadget: pxa27x_udc: " Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 43/64] usb: host: xhci: mvebu: Iterate over array indexes instead of using pointer math Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 44/64] USB: ene_usb6250: Allocate enough memory for full object Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 45/64] usb: uvc: Enumerate valid values for color matching Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 46/64] usb: gadget: uvc: Make bSourceID read/write Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 47/64] PCI: Align extra resources for hotplug bridges properly Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 48/64] PCI: Take other bus devices into account when distributing resources Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 49/64] PCI: Distribute available resources for root buses, too Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 50/64] tty: pcn_uart: fix memory leak with using debugfs_lookup() Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 51/64] misc: vmw_balloon: " Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 52/64] drivers: base: component: " Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 53/64] drivers: base: dd: " Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 54/64] kernel/time/test_udelay.c: " Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 55/64] kernel/power/energy_model.c: " Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 56/64] kernel/fail_function: " Sasha Levin
2023-03-03 21:40 ` [PATCH AUTOSEL 6.2 57/64] PCI: loongson: Add more devices that need MRRS quirk Sasha Levin
2023-03-03 21:41 ` [PATCH AUTOSEL 6.2 58/64] PCI: Add ACS quirk for Wangxun NICs Sasha Levin
2023-03-03 21:41 ` [PATCH AUTOSEL 6.2 59/64] PCI: pciehp: Add Qualcomm quirk for Command Completed erratum Sasha Levin
2023-03-03 21:41 ` [PATCH AUTOSEL 6.2 60/64] phy: rockchip-typec: Fix unsigned comparison with less than zero Sasha Levin
2023-03-03 21:41 ` [PATCH AUTOSEL 6.2 61/64] RDMA/cma: Distinguish between sockaddr_in and sockaddr_in6 by size Sasha Levin
2023-03-03 21:41 ` [PATCH AUTOSEL 6.2 62/64] iommu: Attach device group to old domain in error path Sasha Levin
2023-03-03 21:41 ` [PATCH AUTOSEL 6.2 63/64] soundwire: cadence: Remove wasted space in response_buf Sasha Levin
2023-03-03 21:41 ` [PATCH AUTOSEL 6.2 64/64] soundwire: cadence: Drain the RX FIFO after an IO timeout Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230303214106.1446460-33-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox