USB: chipidea: fix memory leak with using debugfs_lookup()
Subsystems (10)
Greg Kroah-Hartman
maintainerPATCH 1/13 USB: chipidea: 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.
--- drivers/usb/chipidea/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/chipidea/debug.c +1 -1
@@ -364,5 +364,5 @@ void dbg_create_files(struct ci_hdrc *ci)*/ void dbg_remove_files (struct ci_hdrc *ci) { -debugfs_remove (debugfs_lookup (dev_name (ci->dev), usb_debug_root)); +debugfs_lookup_and_remove (dev_name (ci->dev), usb_debug_root); }
Signature · 1 line
2.39.1
Greg Kroah-Hartman
maintainerPATCH 2/13 USB: ULPI: 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.
--- drivers/usb/common/ulpi.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/usb/common/ulpi.c +6 -8
@@ -271,7 +271,7 @@ static int ulpi_regs_show(struct seq_file *seq, void *data) }DEFINE_SHOW_ATTRIBUTE (ulpi_regs); -#define ULPI_ROOT debugfs_lookup(KBUILD_MODNAME, NULL) +static struct dentry *ulpi_root;static int ulpi_register (struct device *dev,struct ulpi *ulpi) {
@@ -301,7 +301,7 @@ static int ulpi_register(struct device *dev, struct ulpi *ulpi)return ret; } - root =debugfs_create_dir (dev_name (dev),ULPI_ROOT ); + root =debugfs_create_dir (dev_name (dev), ulpi_root);debugfs_create_file ("regs" ,0444 , root, ulpi, &ulpi_regs_fops); dev_dbg(&ulpi->dev, "registered ULPI PHY: vendor %04x, product %04x\n",
@@ -349,8 +349,7 @@ EXPORT_SYMBOL_GPL(ulpi_register_interface);*/ void ulpi_unregister_interface (struct ulpi *ulpi) { -debugfs_remove_recursive (debugfs_lookup (dev_name (&ulpi->dev), -ULPI_ROOT )); +debugfs_lookup_and_remove (dev_name (&ulpi->dev), ulpi_root);device_unregister (&ulpi->dev); }EXPORT_SYMBOL_GPL (ulpi_unregister_interface);
@@ -360,12 +359,11 @@ EXPORT_SYMBOL_GPL(ulpi_unregister_interface);static int __init ulpi_init (void ) {int ret; -struct dentry *root; - root =debugfs_create_dir (KBUILD_MODNAME ,NULL ); + ulpi_root =debugfs_create_dir (KBUILD_MODNAME ,NULL ); ret =bus_register (&ulpi_bus);if (ret) -debugfs_remove (root); +debugfs_remove (ulpi_root);return ret; }subsys_initcall (ulpi_init);
@@ -373,7 +371,7 @@ subsys_initcall(ulpi_init); static void __exit ulpi_exit(void) {bus_unregister (&ulpi_bus); -debugfs_remove_recursive (ULPI_ROOT ); +debugfs_remove (ulpi_root); }module_exit (ulpi_exit);
Signature · 1 line
2.39.1
Re: [PATCH 02/13] USB: ULPI: fix memory leak with using debugfs_lookup()
Quoted 9 lines · Greg Kroah-Hartman
When calling
debugfs_lookup()the result must havedput()called on it, otherwise the memory will leak over time. To make things simpler, just calldebugfs_lookup_and_remove()instead which handles all of the logic at once.Cc Heikki Krogerus <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Quoted 62 lines
--- drivers/usb/common/ulpi.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)drivers/usb/common/ulpi.c +6
-8@@ -271,7 +271,7 @@ static int ulpi_regs_show(struct seq_file *seq, void *data) }DEFINE_SHOW_ATTRIBUTE (ulpi_regs); -#define ULPI_ROOT debugfs_lookup(KBUILD_MODNAME, NULL) +static struct dentry *ulpi_root;static int ulpi_register (struct device *dev,struct ulpi *ulpi) {@@ -301,7 +301,7 @@ static int ulpi_register(struct device *dev, struct ulpi *ulpi)return ret; } - root =debugfs_create_dir (dev_name (dev),ULPI_ROOT ); + root =debugfs_create_dir (dev_name (dev), ulpi_root);debugfs_create_file ("regs" ,0444 , root, ulpi, &ulpi_regs_fops); dev_dbg(&ulpi->dev, "registered ULPI PHY: vendor %04x, product %04x\n",@@ -349,8 +349,7 @@ EXPORT_SYMBOL_GPL(ulpi_register_interface);*/ void ulpi_unregister_interface (struct ulpi *ulpi) { -debugfs_remove_recursive (debugfs_lookup (dev_name (&ulpi->dev), -ULPI_ROOT )); +debugfs_lookup_and_remove (dev_name (&ulpi->dev), ulpi_root);device_unregister (&ulpi->dev); }EXPORT_SYMBOL_GPL (ulpi_unregister_interface);@@ -360,12 +359,11 @@ EXPORT_SYMBOL_GPL(ulpi_unregister_interface);static int __init ulpi_init (void ) {int ret; -struct dentry *root; - root =debugfs_create_dir (KBUILD_MODNAME ,NULL ); + ulpi_root =debugfs_create_dir (KBUILD_MODNAME ,NULL ); ret =bus_register (&ulpi_bus);if (ret) -debugfs_remove (root); +debugfs_remove (ulpi_root);return ret; }subsys_initcall (ulpi_init);@@ -373,7 +371,7 @@ subsys_initcall(ulpi_init); static void __exit ulpi_exit(void) {bus_unregister (&ulpi_bus); -debugfs_remove_recursive (ULPI_ROOT ); +debugfs_remove (ulpi_root); }module_exit (ulpi_exit);Signature · 1 line
2.39.1
Signature · 1 line
heikki
Greg Kroah-Hartman
maintainerPATCH 3/13 USB: uhci: fix memory leak with using debugfs_lookup()
In reply to Greg Kroah-HartmanWhen 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.
--- drivers/usb/host/uhci-hcd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/usb/host/uhci-hcd.c +3 -3
@@ -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; }
Signature · 1 line
2.39.1
Greg Kroah-Hartman
maintainerPATCH 4/13 USB: sl811: fix memory leak with using debugfs_lookup()
In reply to Greg Kroah-HartmanWhen 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.
--- drivers/usb/host/sl811-hcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/sl811-hcd.c +1 -1
@@ -1501,7 +1501,7 @@ static void create_debug_file(struct sl811 *sl811)static void remove_debug_file (struct sl811 *sl811) { -debugfs_remove (debugfs_lookup ("sl811h" , usb_debug_root)); +debugfs_lookup_and_remove ("sl811h" , usb_debug_root); }/*-------------------------------------------------------------------------*/
Signature · 1 line
2.39.1
Greg Kroah-Hartman
maintainerPATCH 5/13 USB: fotg210: fix memory leak with using debugfs_lookup()
In reply to Greg Kroah-HartmanWhen 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.
--- drivers/usb/fotg210/fotg210-hcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/fotg210/fotg210-hcd.c +1 -1
@@ -862,7 +862,7 @@ static inline void remove_debug_files(struct fotg210_hcd *fotg210) {struct usb_bus *bus = &fotg210_to_hcd (fotg210)->self; -debugfs_remove (debugfs_lookup (bus->bus_name, fotg210_debug_root)); +debugfs_lookup_and_remove (bus->bus_name, fotg210_debug_root); }/* handshake - spin reading hc until handshake completes or fails
Signature · 1 line
2.39.1
Re: [PATCH 05/13] USB: fotg210: fix memory leak with using debugfs_lookup()
Quoted 9 lines · Greg Kroah-Hartman
When calling
debugfs_lookup()the result must havedput()called on it, otherwise the memory will leak over time. To make things simpler, just calldebugfs_lookup_and_remove()instead which handles all of the logic at once.Cc Linus Walleij <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Thanks Greg!
Yours,
Linus Walleij
Greg Kroah-Hartman
maintainerPATCH 6/13 USB: isp116x: fix memory leak with using debugfs_lookup()
In reply to Greg Kroah-HartmanWhen 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.
--- drivers/usb/host/isp116x-hcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/isp116x-hcd.c +1 -1
@@ -1205,7 +1205,7 @@ static void create_debug_file(struct isp116x *isp116x)static void remove_debug_file (struct isp116x *isp116x) { -debugfs_remove (debugfs_lookup (hcd_name, usb_debug_root)); +debugfs_lookup_and_remove (hcd_name, usb_debug_root); }#else
Signature · 1 line
2.39.1
Greg Kroah-Hartman
maintainerPATCH 7/13 USB: isp1362: fix memory leak with using debugfs_lookup()
In reply to Greg Kroah-HartmanWhen 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.
--- drivers/usb/host/isp1362-hcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/isp1362-hcd.c +1 -1
@@ -2170,7 +2170,7 @@ static void create_debug_file(struct isp1362_hcd *isp1362_hcd)static void remove_debug_file (struct isp1362_hcd *isp1362_hcd) { -debugfs_remove (debugfs_lookup ("isp1362" , usb_debug_root)); +debugfs_lookup_and_remove ("isp1362" , usb_debug_root); }/*-------------------------------------------------------------------------*/
Signature · 1 line
2.39.1
Greg Kroah-Hartman
maintainerPATCH 8/13 USB: gadget: gr_udc: fix memory leak with using debugfs_lookup()
In reply to Greg Kroah-HartmanWhen 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.
--- drivers/usb/gadget/udc/gr_udc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/udc/gr_udc.c +1 -1
@@ -215,7 +215,7 @@ static void gr_dfs_create(struct gr_udc *dev)static void gr_dfs_delete (struct gr_udc *dev) { -debugfs_remove (debugfs_lookup (dev_name (dev->dev), usb_debug_root)); +debugfs_lookup_and_remove (dev_name (dev->dev), usb_debug_root); }#else /* !CONFIG_USB_GADGET_DEBUG_FS */
Signature · 1 line
2.39.1
Greg Kroah-Hartman
maintainerPATCH 9/13 USB: gadget: bcm63xx_udc: fix memory leak with using debugfs_lookup()
In reply to Greg Kroah-HartmanWhen 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.
--- drivers/usb/gadget/udc/bcm63xx_udc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/udc/bcm63xx_udc.c +1 -1
@@ -2259,7 +2259,7 @@ static void bcm63xx_udc_init_debugfs(struct bcm63xx_udc *udc)*/ static void bcm63xx_udc_cleanup_debugfs (struct bcm63xx_udc *udc) { -debugfs_remove (debugfs_lookup (udc->gadget.name, usb_debug_root)); +debugfs_lookup_and_remove (udc->gadget.name, usb_debug_root); }/***********************************************************************
Signature · 1 line
2.39.1
Greg Kroah-Hartman
maintainerPATCH 10/13 USB: gadget: lpc32xx_udc: fix memory leak with using debugfs_lookup()
In reply to Greg Kroah-HartmanWhen 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.
--- drivers/usb/gadget/udc/lpc32xx_udc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/udc/lpc32xx_udc.c +1 -1
@@ -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
Signature · 1 line
2.39.1
Re: [PATCH 10/13] USB: gadget: lpc32xx_udc: fix memory leak with using debugfs_lookup()
Quoted 5 lines · Greg Kroah-Hartman
When calling
debugfs_lookup()the result must havedput()called on it, otherwise the memory will leak over time. To make things simpler, just calldebugfs_lookup_and_remove()instead which handles all of the logic at once.
Quoted 8 lines
Cc Vladimir Zapolskiy <[email protected]>Cc Jakob Koschel <[email protected]>Cc Miaoqian Lin <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>---
--
Best wishes,
Vladimir
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Greg Kroah-Hartman
maintainerPATCH 11/13 USB: gadget: pxa25x_udc: fix memory leak with using debugfs_lookup()
In reply to Greg Kroah-HartmanWhen 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.
--- drivers/usb/gadget/udc/pxa25x_udc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/udc/pxa25x_udc.c +1 -1
@@ -1340,7 +1340,7 @@ DEFINE_SHOW_ATTRIBUTE(udc_debug);debugfs_create_file (dev->gadget.name, \S_IRUGO ,NULL , dev, &udc_debug_fops); \ } while (0) -#define remove_debug_files (dev) debugfs_remove(debugfs_lookup(dev->gadget.name, NULL)) +#define remove_debug_files (dev) debugfs_lookup_and_remove(dev->gadget.name, NULL)#else /* !CONFIG_USB_GADGET_DEBUG_FILES */
Signature · 7 lines
2.39.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Greg Kroah-Hartman
maintainerPATCH 12/13 USB: gadget: pxa27x_udc: fix memory leak with using debugfs_lookup()
In reply to Greg Kroah-HartmanWhen 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.
--- drivers/usb/gadget/udc/pxa27x_udc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/udc/pxa27x_udc.c +1 -1
@@ -215,7 +215,7 @@ static void pxa_init_debugfs(struct pxa_udc *udc)static void pxa_cleanup_debugfs (struct pxa_udc *udc) { -debugfs_remove (debugfs_lookup (udc->gadget.name, usb_debug_root)); +debugfs_lookup_and_remove (udc->gadget.name, usb_debug_root); }#else
Signature · 7 lines
2.39.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Greg Kroah-Hartman
maintainerPATCH 13/13 USB: gadget: s3c2410_udc: fix memory leak with using debugfs_lookup()
In reply to Greg Kroah-HartmanWhen 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.
--- drivers/usb/gadget/udc/s3c2410_udc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/udc/s3c2410_udc.c +1 -1
@@ -1881,7 +1881,7 @@ static int s3c2410_udc_remove(struct platform_device *pdev)return -EBUSY ;usb_del_gadget_udc (&udc->gadget); -debugfs_remove (debugfs_lookup ("registers" , s3c2410_udc_debugfs_root)); +debugfs_lookup_and_remove ("registers" , s3c2410_udc_debugfs_root);if (udc->vbus_gpiod)free_irq (gpiod_to_irq (udc->vbus_gpiod), udc);
Signature · 7 lines
2.39.1 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH 13/13] USB: gadget: s3c2410_udc: fix memory leak with using debugfs_lookup()
Quoted 5 lines · Greg Kroah-Hartman
When calling
debugfs_lookup()the result must havedput()called on it, otherwise the memory will leak over time. To make things simpler, just calldebugfs_lookup_and_remove()instead which handles all of the logic at once.
Hi Greg,
This driver will be removed in v6.3 via Arnd's tree:
https://lore.kernel.org/all/[email protected]/
I think we can skip any work on this.
Best regards,
Krzysztof
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Greg Kroah-Hartman
maintainerRe: [PATCH 13/13] USB: gadget: s3c2410_udc: fix memory leak with using debugfs_lookup()
Quoted 7 lines · Krzysztof Kozlowski
Quoted 5 lines · Greg Kroah-Hartman
When calling
debugfs_lookup()the result must havedput()called on it, otherwise the memory will leak over time. To make things simpler, just calldebugfs_lookup_and_remove()instead which handles all of the logic at once.
Quoted 6 lines
Hi Greg,
This driver will be removed in v6.3 via Arnd's tree:
https://lore.kernel.org/all/[email protected]/I think we can skip any work on this.
Ok, thanks, I'll drop it from my patch queue for now. If it sticks around, I'll apply it :)
greg k-h
Quoted 9 lines · Greg Kroah-Hartman
When calling
debugfs_lookup()the result must havedput()called on it, otherwise the memory will leak over time. To make things simpler, just calldebugfs_lookup_and_remove()instead which handles all of the logic at once.Cc Peter Chen <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Quoted 18 lines
--- drivers/usb/chipidea/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/usb/chipidea/debug.c +1
-1@@ -364,5 +364,5 @@ void dbg_create_files(struct ci_hdrc *ci)*/ void dbg_remove_files (struct ci_hdrc *ci) { -debugfs_remove (debugfs_lookup (dev_name (ci->dev), usb_debug_root)); +debugfs_lookup_and_remove (dev_name (ci->dev), usb_debug_root); }Signature · 1 line
2.39.1
Signature · 2 lines
Thanks, Peter Chen