From patchwork Thu Feb 2 15:32:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 13126395 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 467BFC64EC7 for ; Thu, 2 Feb 2023 15:35:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232202AbjBBPfa (ORCPT ); Thu, 2 Feb 2023 10:35:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229679AbjBBPej (ORCPT ); Thu, 2 Feb 2023 10:34:39 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEA047307C; Thu, 2 Feb 2023 07:34:02 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E3A9C61BB5; Thu, 2 Feb 2023 15:32:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA8F0C433D2; Thu, 2 Feb 2023 15:32:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1675351966; bh=zYUhwxvav6OX9dqGVpvSV+FIFto0//6GTil1TIfrs/Y=; h=From:To:Cc:Subject:Date:From; b=meqjabsZwYpZDMReGP2gDw4ZJoKDiN9uEJKp+XYVRkF1reNpR+HczMs6SQRzOLXy8 riMdCpBpWPGdct57+Q+wJ6Y70mayWLsWE4DoRJHVsoohROCWchkMFy30elskW3XENJ W0TtDmzFZYrUCdCUG89GW1eGKqnfRyTvyZqZ3rw4= From: Greg Kroah-Hartman To: linux-usb@vger.kernel.org Cc: Greg Kroah-Hartman , Peter Chen , linux-kernel@vger.kernel.org Subject: [PATCH 01/13] USB: chipidea: fix memory leak with using debugfs_lookup() Date: Thu, 2 Feb 2023 16:32:23 +0100 Message-Id: <20230202153235.2412790-1-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=949; i=gregkh@linuxfoundation.org; h=from:subject; bh=zYUhwxvav6OX9dqGVpvSV+FIFto0//6GTil1TIfrs/Y=; b=owGbwMvMwCRo6H6F97bub03G02pJDMm3r09w/KwR4b9RY0diwv/MdwF+t6bNLfGRm/2h/8KX1LNL fgo4dMSyMAgyMciKKbJ82cZzdH/FIUUvQ9vTMHNYmUCGMHBxCsBENu1jmJ9W/tnLJT6KJXFbyTSxBw 9XsxvanWdYMHfJmeWh4kZ9vf9TT/Bs8nbbU5ExGwA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.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: Peter Chen Cc: linux-usb@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Greg Kroah-Hartman Acked-by: Peter Chen --- drivers/usb/chipidea/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/chipidea/debug.c b/drivers/usb/chipidea/debug.c index faf6b078b6c4..bbc610e5bd69 100644 --- a/drivers/usb/chipidea/debug.c +++ b/drivers/usb/chipidea/debug.c @@ -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); } From patchwork Thu Feb 2 15:32:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 13126396 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43B69C64EC5 for ; Thu, 2 Feb 2023 15:35:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232254AbjBBPf1 (ORCPT ); Thu, 2 Feb 2023 10:35:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233380AbjBBPfF (ORCPT ); Thu, 2 Feb 2023 10:35:05 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EED2EB60; Thu, 2 Feb 2023 07:34:28 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 77C96B821D8; Thu, 2 Feb 2023 15:32:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95EBBC4339B; Thu, 2 Feb 2023 15:32:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1675351963; bh=W8DSv7qgYPkYexbSkX652KXx3YSfXCc85HIqh/JEfEs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DEAm3L+ScaUXx0lqCOkFb2NbfzMNsEb53lt2SHnoJq4EyD60t5/vFYWVHDVBrUZ/U bZcV1Ms0UAHrNOTa5V51qe0DVgjAh53fAEqSeGNA7n3Wib2XwUI47OLrmCtWd8Lcvw HDNo01wGlRLaffNIuQMvHNMO19ICuaWcZo+QZp1o= From: Greg Kroah-Hartman To: linux-usb@vger.kernel.org Cc: Greg Kroah-Hartman , Heikki Krogerus , linux-kernel@vger.kernel.org Subject: [PATCH 02/13] USB: ULPI: fix memory leak with using debugfs_lookup() Date: Thu, 2 Feb 2023 16:32:24 +0100 Message-Id: <20230202153235.2412790-2-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230202153235.2412790-1-gregkh@linuxfoundation.org> References: <20230202153235.2412790-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2357; i=gregkh@linuxfoundation.org; h=from:subject; bh=W8DSv7qgYPkYexbSkX652KXx3YSfXCc85HIqh/JEfEs=; b=owGbwMvMwCRo6H6F97bub03G02pJDMm3r0/UVkp89WAn02FrNf9z5yyC/X5mHn9oePvDzi0hp27y zk3z6YhlYRBkYpAVU2T5so3n6P6KQ4pehranYeawMoEMYeDiFICJLMlhmB/+akPvxpemyzeIGJsq6U u+2h9wg5VhrkRdbeb3g1MsnloYhlfM9PVdI3CiDAA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.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: Heikki Krogerus Cc: linux-usb@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Greg Kroah-Hartman Acked-by: Heikki Krogerus --- drivers/usb/common/ulpi.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/usb/common/ulpi.c b/drivers/usb/common/ulpi.c index 67b780b256a9..a98b2108376a 100644 --- a/drivers/usb/common/ulpi.c +++ b/drivers/usb/common/ulpi.c @@ -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); From patchwork Thu Feb 2 15:32:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 13126394 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 143EAC636D4 for ; Thu, 2 Feb 2023 15:35:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231707AbjBBPfY (ORCPT ); Thu, 2 Feb 2023 10:35:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233270AbjBBPez (ORCPT ); Thu, 2 Feb 2023 10:34:55 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3807C7BBD0; Thu, 2 Feb 2023 07:34:19 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8E94A61BEA; Thu, 2 Feb 2023 15:33:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32748C433EF; Thu, 2 Feb 2023 15:32:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1675351980; bh=iLS6jB8PnaUfJcgK7/7WcP/XfHedo1QulI0SnIMSF1c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q/yRI6r3i9fZcOWPYmkZzMVeJHrtZNlU7+MVXcum1wpWDHq6RgX06A+rhaXN8SWxf 7TYjJE4yc0BhQ1AoLkky02whJ8PdfQeh/eI3JazJjNkRvzC6qz1GZMEsUWYa6DmnMT kXZnCupwJ+CNrvqxxR70R0GEkZpq1zpHckb9Vbys= From: Greg Kroah-Hartman To: linux-usb@vger.kernel.org Cc: Greg Kroah-Hartman , Alan Stern , linux-kernel@vger.kernel.org Subject: [PATCH 03/13] USB: uhci: fix memory leak with using debugfs_lookup() Date: Thu, 2 Feb 2023 16:32:25 +0100 Message-Id: <20230202153235.2412790-3-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230202153235.2412790-1-gregkh@linuxfoundation.org> References: <20230202153235.2412790-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1405; i=gregkh@linuxfoundation.org; h=from:subject; bh=iLS6jB8PnaUfJcgK7/7WcP/XfHedo1QulI0SnIMSF1c=; b=owGbwMvMwCRo6H6F97bub03G02pJDMm3r09USimuWvPDbun5yTefmwb/6L5ly2bPxrH40QWnqYdP b/A17ohlYRBkYpAVU2T5so3n6P6KQ4pehranYeawMoEMYeDiFICJHHjNMN8nZjfrpZJXm9el6G5IkT rQzPxoXSrD/NKTO+q9Nm7y47zys+TkIdufbHVmbwE= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.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: Alan Stern Cc: linux-usb@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- 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 c22b51af83fc..7cdc2fa7c28f 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; } From patchwork Thu Feb 2 15:32:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 13126400 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 963C9C64ED9 for ; Thu, 2 Feb 2023 15:35:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232363AbjBBPfd (ORCPT ); Thu, 2 Feb 2023 10:35:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232067AbjBBPf1 (ORCPT ); Thu, 2 Feb 2023 10:35:27 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B26296E9B; Thu, 2 Feb 2023 07:34:57 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 53041B826B7; Thu, 2 Feb 2023 15:33:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9486EC4339B; Thu, 2 Feb 2023 15:33:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1675351983; bh=Qda/PQv4RqX7g5dgxLcjBeYi+1CYJvm2YonTqRTHp+g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KALluE7lJtGUkrnFm20tyBKum8/w3TbICvviZ/It3rBf/4T+x5MOQTu4Co3Mp7DRP HVwrCAWzC0nkk6c7wLAlmtfCHRxkYrB9Zu1eqBYbJV2mOh6rHSXmQ0PVQNgnTV53rH k9SebNJCICbs7COFDLc91CaG9GPBBBfAPuOD6y8A= From: Greg Kroah-Hartman To: linux-usb@vger.kernel.org Cc: Greg Kroah-Hartman , Vincent Mailhol , linux-kernel@vger.kernel.org Subject: [PATCH 04/13] USB: sl811: fix memory leak with using debugfs_lookup() Date: Thu, 2 Feb 2023 16:32:26 +0100 Message-Id: <20230202153235.2412790-4-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230202153235.2412790-1-gregkh@linuxfoundation.org> References: <20230202153235.2412790-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1041; i=gregkh@linuxfoundation.org; h=from:subject; bh=Qda/PQv4RqX7g5dgxLcjBeYi+1CYJvm2YonTqRTHp+g=; b=owGbwMvMwCRo6H6F97bub03G02pJDMm3r08sePN5rmds879195Im6Tst7F/gf63qZGBjj+j9Q5tP tIh7d8SyMAgyMciKKbJ82cZzdH/FIUUvQ9vTMHNYmUCGMHBxCsBErKUZFjSoLnryeQODXe79UyKlxm 3nBRc4VjPMj3k5v+/JJDGv46VTpEQ/bGnWMgg3BAA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.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: Vincent Mailhol Cc: linux-usb@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/sl811-hcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c index d206bd95c7bb..b8b90eec9107 100644 --- a/drivers/usb/host/sl811-hcd.c +++ b/drivers/usb/host/sl811-hcd.c @@ -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); } /*-------------------------------------------------------------------------*/ From patchwork Thu Feb 2 15:32:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 13126398 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6598C64ED8 for ; Thu, 2 Feb 2023 15:35:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232295AbjBBPfb (ORCPT ); Thu, 2 Feb 2023 10:35:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233327AbjBBPe7 (ORCPT ); Thu, 2 Feb 2023 10:34:59 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 226E86B025; Thu, 2 Feb 2023 07:34:23 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7B21961BE9; Thu, 2 Feb 2023 15:33:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78FD4C433D2; Thu, 2 Feb 2023 15:33:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1675351985; bh=tIvo5TZOENRUN+V2jHoBHcC8wyCCjHYFP1TOGz+IonM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R4kL0i/ts2k15V0PqGI8yGeLgBGbiehaI86XRV8RMD3TVMYGJeqfiEpzYiQKPwJTT 9L9bR2Q+jx6vkMACOvXNAOtn4qSX3AiZGSGEQBUE22UwP9PQZ41WP+ZrNXNXoJKMte jdK9bm2C/bVGaG3jE4qubQ8/DQ70aXX/usDcOG30= From: Greg Kroah-Hartman To: linux-usb@vger.kernel.org Cc: Greg Kroah-Hartman , Linus Walleij , linux-kernel@vger.kernel.org Subject: [PATCH 05/13] USB: fotg210: fix memory leak with using debugfs_lookup() Date: Thu, 2 Feb 2023 16:32:27 +0100 Message-Id: <20230202153235.2412790-5-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230202153235.2412790-1-gregkh@linuxfoundation.org> References: <20230202153235.2412790-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1086; i=gregkh@linuxfoundation.org; h=from:subject; bh=tIvo5TZOENRUN+V2jHoBHcC8wyCCjHYFP1TOGz+IonM=; b=owGbwMvMwCRo6H6F97bub03G02pJDMm3r080+3Znw90Om2KuU0scFpfxPNzk//v+1w//XsTsY/Dw 1ly4tCOWhUGQiUFWTJHlyzaeo/srDil6GdqehpnDygQyhIGLUwAm8i6EYZ5OjefHFZHahfUC1ff+mC QvEGHv/cqwYF5lq9OPT3/tU0UnLsqcfuM3V8EhUQA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.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: Linus Walleij Cc: linux-usb@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Greg Kroah-Hartman Reviewed-by: Linus Walleij --- drivers/usb/fotg210/fotg210-hcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/fotg210/fotg210-hcd.c b/drivers/usb/fotg210/fotg210-hcd.c index 51ac93a2eb98..1c5eb8f8c19c 100644 --- a/drivers/usb/fotg210/fotg210-hcd.c +++ b/drivers/usb/fotg210/fotg210-hcd.c @@ -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 From patchwork Thu Feb 2 15:32:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 13126399 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2A4CC61DA4 for ; Thu, 2 Feb 2023 15:35:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231971AbjBBPfc (ORCPT ); Thu, 2 Feb 2023 10:35:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231359AbjBBPfX (ORCPT ); Thu, 2 Feb 2023 10:35:23 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58FE9279A4; Thu, 2 Feb 2023 07:34:52 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3E09B61BDF; Thu, 2 Feb 2023 15:33:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3AF08C4339B; Thu, 2 Feb 2023 15:33:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1675351988; bh=gODC2aLPKGO7RjywvEnuzK1998oMNqPjX9wx4dajC7Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ew6EyN5506MnHVqYz2CemnwHj5fWpBLRetRyY74DQ4nkuQZmwxyn6lecT32koQS8I 5rlX5tVWYRtnipOi2fVegH2Eme8Xixin23vU6XHIBCzC4cr6xNDkmZOqGTwHxOkAB2 Eo38+NwUCPPoy4pjrqZnyEg93mfC3cdfyxeJtpKQ= From: Greg Kroah-Hartman To: linux-usb@vger.kernel.org Cc: Greg Kroah-Hartman , Olav Kongas , linux-kernel@vger.kernel.org Subject: [PATCH 06/13] USB: isp116x: fix memory leak with using debugfs_lookup() Date: Thu, 2 Feb 2023 16:32:28 +0100 Message-Id: <20230202153235.2412790-6-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230202153235.2412790-1-gregkh@linuxfoundation.org> References: <20230202153235.2412790-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=974; i=gregkh@linuxfoundation.org; h=from:subject; bh=gODC2aLPKGO7RjywvEnuzK1998oMNqPjX9wx4dajC7Y=; b=owGbwMvMwCRo6H6F97bub03G02pJDMm3r08Uiec9yDfJUnr675JHvMU8Py89qJv6zMFpSYNett2t /XZiHbEsDIJMDLJiiixftvEc3V9xSNHL0PY0zBxWJpAhDFycAjARu1sM8/Q/aIbJnl49Qyp0B79HwO obvrMWRDLML99U+Wt1+fXQFWGxByQkH2x9L+6iBAA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.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: Olav Kongas Cc: linux-usb@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/isp116x-hcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/host/isp116x-hcd.c b/drivers/usb/host/isp116x-hcd.c index 4f564d71bb0b..49ae01487af4 100644 --- a/drivers/usb/host/isp116x-hcd.c +++ b/drivers/usb/host/isp116x-hcd.c @@ -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 From patchwork Thu Feb 2 15:32:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 13126401 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 876EBC64EC3 for ; Thu, 2 Feb 2023 15:36:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232758AbjBBPgK (ORCPT ); Thu, 2 Feb 2023 10:36:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233326AbjBBPfw (ORCPT ); Thu, 2 Feb 2023 10:35:52 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF50B6950F; Thu, 2 Feb 2023 07:35:24 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A48A9B82688; Thu, 2 Feb 2023 15:33:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7BA6C433D2; Thu, 2 Feb 2023 15:33:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1675351991; bh=Qxq2Azs1q6cerOsyDuVhXTx/eaL+5JdsQi0iF0CnjCM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LplWbCoZniMJ+QI5Yk9OwYw25kggfG4Kskew/LZOkVpBv2XqHiLaXUiJt8EHrhDJQ Jd1KAvKSR20MSpB5JVzUqudftE2JVSduqaZWvp2guQE/ZW28/r+hWSSW5X1prbK39f BR1jx7GfUykBM6hurXFacQ3amAv0Y9juiql8p6Io= From: Greg Kroah-Hartman To: linux-usb@vger.kernel.org Cc: Greg Kroah-Hartman , Vincent Mailhol , linux-kernel@vger.kernel.org Subject: [PATCH 07/13] USB: isp1362: fix memory leak with using debugfs_lookup() Date: Thu, 2 Feb 2023 16:32:29 +0100 Message-Id: <20230202153235.2412790-7-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230202153235.2412790-1-gregkh@linuxfoundation.org> References: <20230202153235.2412790-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1077; i=gregkh@linuxfoundation.org; h=from:subject; bh=Qxq2Azs1q6cerOsyDuVhXTx/eaL+5JdsQi0iF0CnjCM=; b=owGbwMvMwCRo6H6F97bub03G02pJDMm3r08KE39+eWe0WSJPkEaPwhUJz3v3i54F3NsX0a7PuqWx VretI5aFQZCJQVZMkeXLNp6j+ysOKXoZ2p6GmcPKBDKEgYtTACZy5wzDgqYZc2tYd+bFZRWc5+TlaV jDYq8wkWFB84XEhLdilWmdtyWCv0Xu3+RRsWwDAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.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: Vincent Mailhol Cc: linux-usb@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/isp1362-hcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/host/isp1362-hcd.c b/drivers/usb/host/isp1362-hcd.c index 0e14d1d07709..b0da143ef4be 100644 --- a/drivers/usb/host/isp1362-hcd.c +++ b/drivers/usb/host/isp1362-hcd.c @@ -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); } /*-------------------------------------------------------------------------*/ From patchwork Thu Feb 2 15:32:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 13126421 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39735C61DA4 for ; Thu, 2 Feb 2023 15:40:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232196AbjBBPk6 (ORCPT ); Thu, 2 Feb 2023 10:40:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232391AbjBBPky (ORCPT ); Thu, 2 Feb 2023 10:40:54 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9037EBB9D; Thu, 2 Feb 2023 07:40:30 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 74A2C61B8C; Thu, 2 Feb 2023 15:33:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C54CC433EF; Thu, 2 Feb 2023 15:33:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1675351993; bh=OCpQGd9y36W01Js+1AiolPPhc/FDiwwFSG64ouudZug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KtEH7vhpb2gAmASrAaDeEBopioNdxclZKkTX7mUVj6INLSzh8G5eTL1+IguvHPu02 gfH+ZYc1bWES9rretKPDf19QyNUwUIzRAsyibdHI4jRQe1gYPCGQvzBQhf7e/IFy8W TOGpzuL3ZlWBmB6LHJkjbj5mghGUkzObB+CNXp6c= From: Greg Kroah-Hartman To: linux-usb@vger.kernel.org Cc: Greg Kroah-Hartman , Jakob Koschel , linux-kernel@vger.kernel.org Subject: [PATCH 08/13] USB: gadget: gr_udc: fix memory leak with using debugfs_lookup() Date: Thu, 2 Feb 2023 16:32:30 +0100 Message-Id: <20230202153235.2412790-8-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230202153235.2412790-1-gregkh@linuxfoundation.org> References: <20230202153235.2412790-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1020; i=gregkh@linuxfoundation.org; h=from:subject; bh=OCpQGd9y36W01Js+1AiolPPhc/FDiwwFSG64ouudZug=; b=owGbwMvMwCRo6H6F97bub03G02pJDMm3r0+6Jjrf0IQv3T1LNdVebeNUmRsbr/fMWSLx8o5sYMfp en7rjlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZiIxWGG+TFX25p4vs5aIeC55XN9VO 7r+G07ZzPMj/CSbLzMalPfWxzscXd/XH+DtRA7AA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.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: Jakob Koschel Cc: linux-usb@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/udc/gr_udc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/gadget/udc/gr_udc.c b/drivers/usb/gadget/udc/gr_udc.c index 22096f8505de..52c12c96c275 100644 --- a/drivers/usb/gadget/udc/gr_udc.c +++ b/drivers/usb/gadget/udc/gr_udc.c @@ -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 */ From patchwork Thu Feb 2 15:32:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 13126402 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D137C636D4 for ; Thu, 2 Feb 2023 15:37:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232402AbjBBPhK (ORCPT ); Thu, 2 Feb 2023 10:37:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232938AbjBBPgr (ORCPT ); Thu, 2 Feb 2023 10:36:47 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E35C402D2; Thu, 2 Feb 2023 07:36:07 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E206DB826B8; Thu, 2 Feb 2023 15:33:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29BF5C4339E; Thu, 2 Feb 2023 15:33:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1675351996; bh=dnzVHu0pYh41EtriuTqveo6jeJTCVWTwi6pTRGgwTIw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qbCmAFhpMCMfAQ1L9PcrMi6YUnf/FsvqFb3e/cthBO6vVhek73nErGby4VxR/yx3K AcyGoq0kLrBlSpcrUnyaW+oMXMElPci3M0JWnDhlxxbGDAZd2qEBsCKrMLHTQCjfp3 pKPoGv9Z/e2j3sCYKqsay4rPaXLkoh54hXffXuHo= From: Greg Kroah-Hartman To: linux-usb@vger.kernel.org Cc: Greg Kroah-Hartman , Kevin Cernekee , linux-kernel@vger.kernel.org Subject: [PATCH 09/13] USB: gadget: bcm63xx_udc: fix memory leak with using debugfs_lookup() Date: Thu, 2 Feb 2023 16:32:31 +0100 Message-Id: <20230202153235.2412790-9-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230202153235.2412790-1-gregkh@linuxfoundation.org> References: <20230202153235.2412790-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1111; i=gregkh@linuxfoundation.org; h=from:subject; bh=dnzVHu0pYh41EtriuTqveo6jeJTCVWTwi6pTRGgwTIw=; b=owGbwMvMwCRo6H6F97bub03G02pJDMm3r09yD9rMHBIZtXdRWrCDhJvee/Pgx0eFJA/mqfFcVJCx rDvcEcvCIMjEICumyPJlG8/R/RWHFL0MbU/DzGFlAhnCwMUpABNJS2GYH6L89udlbzvPfR/kLxUHLX trFNXxh2Gu6AlJ24DNtc+Ec7n5xdN+Lf56Sa8ZAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.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: Kevin Cernekee Cc: linux-usb@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/udc/bcm63xx_udc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/gadget/udc/bcm63xx_udc.c b/drivers/usb/gadget/udc/bcm63xx_udc.c index 2cdb07905bde..90cf78aa65df 100644 --- a/drivers/usb/gadget/udc/bcm63xx_udc.c +++ b/drivers/usb/gadget/udc/bcm63xx_udc.c @@ -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); } /*********************************************************************** From patchwork Thu Feb 2 15:32:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 13126403 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3931FC636D6 for ; Thu, 2 Feb 2023 15:37:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232773AbjBBPhM (ORCPT ); Thu, 2 Feb 2023 10:37:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232889AbjBBPgq (ORCPT ); Thu, 2 Feb 2023 10:36:46 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 538E44F86B; Thu, 2 Feb 2023 07:36:06 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CAF0DB826AD; Thu, 2 Feb 2023 15:33:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1103CC4339C; Thu, 2 Feb 2023 15:33:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1675351999; bh=LxA279H1FvrJsAusP/AZ5gRL/bHuKKZsq2ugyns8LMw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nI3g5+y7Skra/emw8kuhlV9ktB54HmaJDyN9sJzPlqo2gT+e3C4eBZPR45Q0u0aTR IFhRpwUt1zN7PyvBl4KkQYwzP378dY0AnGSMaorT+oBkD74KNcivMoZ12rtxkZhLND IpbzE1DsHQB4xwq9QJ/X3HcY9OlL3vNXM/yKZzzc= From: Greg Kroah-Hartman To: linux-usb@vger.kernel.org Cc: Greg Kroah-Hartman , Vladimir Zapolskiy , Jakob Koschel , Miaoqian Lin , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 10/13] USB: gadget: lpc32xx_udc: fix memory leak with using debugfs_lookup() Date: Thu, 2 Feb 2023 16:32:32 +0100 Message-Id: <20230202153235.2412790-10-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230202153235.2412790-1-gregkh@linuxfoundation.org> References: <20230202153235.2412790-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1121; i=gregkh@linuxfoundation.org; h=from:subject; bh=LxA279H1FvrJsAusP/AZ5gRL/bHuKKZsq2ugyns8LMw=; b=owGbwMvMwCRo6H6F97bub03G02pJDMm3r086e3N95v++mDfTLTbt0d/4QEnTJjFWIcH9wqPd6inn b1mc7ohlYRBkYpAVU2T5so3n6P6KQ4pehranYeawMoEMYeDiFICJLGljmF8ovfvh1wSfn47J/rqXPE Js3l270cawYI17wtnLkyWb380Kjgz0Fo07PCvkLQA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.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: Vladimir Zapolskiy Cc: Jakob Koschel Cc: Miaoqian Lin Cc: linux-usb@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Greg Kroah-Hartman Acked-by: Vladimir Zapolskiy --- drivers/usb/gadget/udc/lpc32xx_udc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/gadget/udc/lpc32xx_udc.c b/drivers/usb/gadget/udc/lpc32xx_udc.c index cea10cdb83ae..fe62db32dd0e 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 From patchwork Thu Feb 2 15:32:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 13126397 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F383DC64ED6 for ; Thu, 2 Feb 2023 15:35:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232047AbjBBPf0 (ORCPT ); Thu, 2 Feb 2023 10:35:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233407AbjBBPfJ (ORCPT ); Thu, 2 Feb 2023 10:35:09 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 436B8CDE1; Thu, 2 Feb 2023 07:34:35 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E3C9CB82668; Thu, 2 Feb 2023 15:32:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D026C433D2; Thu, 2 Feb 2023 15:32:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1675351970; bh=qgGQABR7gucesTyg698uv7KAjG+gWnR2iJwdcpyFLlQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JL4wpma4t/XIE+rFyrRzsiAyGIWNQkSIa/PEwQGtbGcONjxssxnAPcpIxYVKBKstm Nerl96avk0YKXe8LhSRYPx7bGKvuuwNvkKrxuzBr/ahD29BtwG12LBK5X1vH613Vgk OKNY86VMenEB5RGwtYTSBzlfbG6KU6SIQ8r2HzWc= From: Greg Kroah-Hartman To: linux-usb@vger.kernel.org Cc: Greg Kroah-Hartman , Daniel Mack , Haojian Zhuang , Robert Jarzmik , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 11/13] USB: gadget: pxa25x_udc: fix memory leak with using debugfs_lookup() Date: Thu, 2 Feb 2023 16:32:33 +0100 Message-Id: <20230202153235.2412790-11-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230202153235.2412790-1-gregkh@linuxfoundation.org> References: <20230202153235.2412790-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1244; i=gregkh@linuxfoundation.org; h=from:subject; bh=qgGQABR7gucesTyg698uv7KAjG+gWnR2iJwdcpyFLlQ=; b=owGbwMvMwCRo6H6F97bub03G02pJDMm3r08unvrdTfqr2N36oG9aXccnH9m89WzovmiffT+zrx9k T8m17ohlYRBkYpAVU2T5so3n6P6KQ4pehranYeawMoEMYeDiFICJGF1jWLCMofH7yc1C9S/ez5+xwj imr+NSfDPDbNZIa9kt384XCP3Z6zo94qPf7AtVXgA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.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: Daniel Mack Cc: Haojian Zhuang Cc: Robert Jarzmik Cc: linux-arm-kernel@lists.infradead.org Cc: linux-usb@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/udc/pxa25x_udc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/gadget/udc/pxa25x_udc.c b/drivers/usb/gadget/udc/pxa25x_udc.c index c593fc383481..9e01ddf2b417 100644 --- a/drivers/usb/gadget/udc/pxa25x_udc.c +++ b/drivers/usb/gadget/udc/pxa25x_udc.c @@ -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 */ From patchwork Thu Feb 2 15:32:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 13126420 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8992C61DA4 for ; Thu, 2 Feb 2023 15:39:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231705AbjBBPjk (ORCPT ); Thu, 2 Feb 2023 10:39:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232039AbjBBPj0 (ORCPT ); Thu, 2 Feb 2023 10:39:26 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F51C728E2; Thu, 2 Feb 2023 07:39:03 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C1AFBB826B3; Thu, 2 Feb 2023 15:32:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14C19C433EF; Thu, 2 Feb 2023 15:32:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1675351973; bh=/fC3SKgXnhxkXkgQHHlU+wUOPEms2EA6dwlfaZmQUFI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ljXSTmo5e1AygfdcBvZlTUrri+5OrgrYA+B7M82PQBBUvhJOk0Uyr1dxqqrWOpSr6 3oAh5RQ79jcrFefSbvk6Ly114d308Mf99Xw5z0C9beUri33KwgBBoML0vc+SjRgYGT X9brIiiRr/f178w3E+8sdpWQe7UT1qQSliFxgsQg= From: Greg Kroah-Hartman To: linux-usb@vger.kernel.org Cc: Greg Kroah-Hartman , Daniel Mack , Haojian Zhuang , Robert Jarzmik , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 12/13] USB: gadget: pxa27x_udc: fix memory leak with using debugfs_lookup() Date: Thu, 2 Feb 2023 16:32:34 +0100 Message-Id: <20230202153235.2412790-12-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230202153235.2412790-1-gregkh@linuxfoundation.org> References: <20230202153235.2412790-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1140; i=gregkh@linuxfoundation.org; h=from:subject; bh=/fC3SKgXnhxkXkgQHHlU+wUOPEms2EA6dwlfaZmQUFI=; b=owGbwMvMwCRo6H6F97bub03G02pJDMm3r0/etLQ/unLpHTYdy6KS726bn5Tt2bf2cMaXxhk3Xh39 kK14siOWhUGQiUFWTJHlyzaeo/srDil6GdqehpnDygQyhIGLUwAmwm3LMD+uQXpG2tcFieaKy5Z/Za 047SBsP4dhDr/5t2o77oy4p/svO/5Nak0/8prdFQA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.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: Daniel Mack Cc: Haojian Zhuang Cc: Robert Jarzmik Cc: linux-arm-kernel@lists.infradead.org Cc: linux-usb@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/udc/pxa27x_udc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/gadget/udc/pxa27x_udc.c b/drivers/usb/gadget/udc/pxa27x_udc.c index ac980d6a4740..0ecdfd2ba9e9 100644 --- a/drivers/usb/gadget/udc/pxa27x_udc.c +++ b/drivers/usb/gadget/udc/pxa27x_udc.c @@ -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 From patchwork Thu Feb 2 15:32:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 13126422 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59380C61DA4 for ; Thu, 2 Feb 2023 15:43:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231866AbjBBPnU (ORCPT ); Thu, 2 Feb 2023 10:43:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231482AbjBBPnS (ORCPT ); Thu, 2 Feb 2023 10:43:18 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85CCA27D46; Thu, 2 Feb 2023 07:42:55 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B829461BE2; Thu, 2 Feb 2023 15:32:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA6DFC4339B; Thu, 2 Feb 2023 15:32:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1675351976; bh=9jlFcZReaRqGG5HOvntUdmyxy0CRaO52IN9kpSRb2vs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L/d22WHalF5IHieEA4ZC3AdeKcY3j4jnBr2gh1Zj2mWqDDsuQpS0haOplVBNpPmLH OjrXrrg3HRti65BZYpgzkNgZE3SWX0VYdxW2gnkLUGX4SBq1QQxt5aMMUfia4foUeg X62puFv1JX/3I+0OBWuz5wnVwwHj9ze7NTHweqtw= From: Greg Kroah-Hartman To: linux-usb@vger.kernel.org Cc: Greg Kroah-Hartman , Krzysztof Kozlowski , Alim Akhtar , Linus Walleij , Jakob Koschel , 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 Message-Id: <20230202153235.2412790-13-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230202153235.2412790-1-gregkh@linuxfoundation.org> References: <20230202153235.2412790-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1327; i=gregkh@linuxfoundation.org; h=from:subject; bh=9jlFcZReaRqGG5HOvntUdmyxy0CRaO52IN9kpSRb2vs=; b=owGbwMvMwCRo6H6F97bub03G02pJDMm3r09eL5hl8nPLpjW9Ex/53eWat+utokDKkYcxQV9a05Yt YKnX7YhlYRBkYpAVU2T5so3n6P6KQ4pehranYeawMoEMYeDiFICJPLZmmF+7cu2Ca7vnFfyz2Hta8r FI2dHca7MY5nAaKEa/PxRfsrPmDYv45xgu2w7R9QA= X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.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 Cc: Alim Akhtar Cc: Linus Walleij Cc: Jakob Koschel 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 --- 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);