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 KH X-Patchwork-Id: 650604 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 --- 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:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 650602 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 KH X-Patchwork-Id: 650601 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 KH X-Patchwork-Id: 650599 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:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 650600 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 --- 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 KH X-Patchwork-Id: 650603 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 */