From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> To: linux-usb@vger.kernel.org Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>, Alim Akhtar <alim.akhtar@samsung.com>, Linus Walleij <linus.walleij@linaro.org>, Jakob Koschel <jakobkoschel@gmail.com>, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 13/13] USB: gadget: s3c2410_udc: fix memory leak with using debugfs_lookup() Date: Thu, 2 Feb 2023 16:32:35 +0100 [thread overview] Message-ID: <20230202153235.2412790-13-gregkh@linuxfoundation.org> (raw) In-Reply-To: <20230202153235.2412790-1-gregkh@linuxfoundation.org> 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: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Cc: Alim Akhtar <alim.akhtar@samsung.com> Cc: Linus Walleij <linus.walleij@linaro.org> Cc: Jakob Koschel <jakobkoschel@gmail.com> Cc: linux-usb@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-samsung-soc@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/usb/gadget/udc/s3c2410_udc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/gadget/udc/s3c2410_udc.c b/drivers/usb/gadget/udc/s3c2410_udc.c index 8c57b191e52b..3525a3c260a7 100644 --- a/drivers/usb/gadget/udc/s3c2410_udc.c +++ b/drivers/usb/gadget/udc/s3c2410_udc.c @@ -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); -- 2.39.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
WARNING: multiple messages have this Message-ID (diff)
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> To: linux-usb@vger.kernel.org Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>, Alim Akhtar <alim.akhtar@samsung.com>, Linus Walleij <linus.walleij@linaro.org>, Jakob Koschel <jakobkoschel@gmail.com>, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 13/13] USB: gadget: s3c2410_udc: fix memory leak with using debugfs_lookup() Date: Thu, 2 Feb 2023 16:32:35 +0100 [thread overview] Message-ID: <20230202153235.2412790-13-gregkh@linuxfoundation.org> (raw) In-Reply-To: <20230202153235.2412790-1-gregkh@linuxfoundation.org> 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: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Cc: Alim Akhtar <alim.akhtar@samsung.com> Cc: Linus Walleij <linus.walleij@linaro.org> Cc: Jakob Koschel <jakobkoschel@gmail.com> Cc: linux-usb@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-samsung-soc@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- drivers/usb/gadget/udc/s3c2410_udc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/gadget/udc/s3c2410_udc.c b/drivers/usb/gadget/udc/s3c2410_udc.c index 8c57b191e52b..3525a3c260a7 100644 --- a/drivers/usb/gadget/udc/s3c2410_udc.c +++ b/drivers/usb/gadget/udc/s3c2410_udc.c @@ -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); -- 2.39.1
next prev parent reply other threads:[~2023-02-02 15:35 UTC|newest] Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-02-02 15:32 [PATCH 01/13] USB: chipidea: fix memory leak with using debugfs_lookup() Greg Kroah-Hartman 2023-02-02 15:32 ` [PATCH 02/13] USB: ULPI: " Greg Kroah-Hartman 2023-02-03 9:05 ` Heikki Krogerus 2023-02-02 15:32 ` [PATCH 03/13] USB: uhci: " Greg Kroah-Hartman 2023-02-02 15:32 ` [PATCH 04/13] USB: sl811: " Greg Kroah-Hartman 2023-02-02 15:32 ` [PATCH 05/13] USB: fotg210: " Greg Kroah-Hartman 2023-02-02 22:15 ` Linus Walleij 2023-02-02 15:32 ` [PATCH 06/13] USB: isp116x: " Greg Kroah-Hartman 2023-02-02 15:32 ` [PATCH 07/13] USB: isp1362: " Greg Kroah-Hartman 2023-02-02 15:32 ` [PATCH 08/13] USB: gadget: gr_udc: " Greg Kroah-Hartman 2023-02-02 15:32 ` [PATCH 09/13] USB: gadget: bcm63xx_udc: " Greg Kroah-Hartman 2023-02-02 15:32 ` [PATCH 10/13] USB: gadget: lpc32xx_udc: " Greg Kroah-Hartman 2023-02-02 15:32 ` Greg Kroah-Hartman 2023-02-02 16:24 ` Vladimir Zapolskiy 2023-02-02 16:24 ` Vladimir Zapolskiy 2023-02-02 15:32 ` [PATCH 11/13] USB: gadget: pxa25x_udc: " Greg Kroah-Hartman 2023-02-02 15:32 ` Greg Kroah-Hartman 2023-02-02 15:32 ` [PATCH 12/13] USB: gadget: pxa27x_udc: " Greg Kroah-Hartman 2023-02-02 15:32 ` Greg Kroah-Hartman 2023-02-02 15:32 ` Greg Kroah-Hartman [this message] 2023-02-02 15:32 ` [PATCH 13/13] USB: gadget: s3c2410_udc: " Greg Kroah-Hartman 2023-02-03 8:20 ` Krzysztof Kozlowski 2023-02-03 8:20 ` Krzysztof Kozlowski 2023-02-06 9:57 ` Greg Kroah-Hartman 2023-02-06 9:57 ` Greg Kroah-Hartman 2023-02-10 8:51 ` [PATCH 01/13] USB: chipidea: " Peter Chen
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=20230202153235.2412790-13-gregkh@linuxfoundation.org \ --to=gregkh@linuxfoundation.org \ --cc=alim.akhtar@samsung.com \ --cc=jakobkoschel@gmail.com \ --cc=krzysztof.kozlowski@linaro.org \ --cc=linus.walleij@linaro.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-samsung-soc@vger.kernel.org \ --cc=linux-usb@vger.kernel.org \ /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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.