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: 13126423 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 45FD0C636D4 for ; Thu, 2 Feb 2023 15:39:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+jTFWx+KSatrt00jPWCWwhM5jXMCwYXj27ol5H35sUo=; b=e24K70SLsLV8QE 9VkW5ovSiyUOKUBwZi6ceSEdPn+5U69/QHmrpJctcuez7Bmqz8FtcxkMcSXcB9cXqeClnkPXExqy1 eVtyQ4sHsQ2J3v2fgN90zNk/kZDDO3bM+GJ/PtW+uLt364FKlMgRqto2YvSjFSssZH6Q2+bXa/nAZ b2QENGWiJ6bR+q0PI7LcOvYIreN2Fw8q5agBG7Hrc4bNevDgul26pOGMqA1an2tb6Sof4cWrzlly7 ndOKlpv2iNPppx3xAGGEZ/j3boFBsnBmEdjdOCkJuaFjkgTA19Q0VjNBXCn+4GpkqLLfOAIjoQLdf kByy6N8JsFptw8Qr5BuA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNbfR-00GSgJ-18; Thu, 02 Feb 2023 15:38:29 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNbaT-00GPyO-AE for linux-arm-kernel@lists.infradead.org; Thu, 02 Feb 2023 15:33:25 +0000 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 A82FA61BED; 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230202_073321_486343_A38BCB86 X-CRM114-Status: GOOD ( 13.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 KH X-Patchwork-Id: 13126404 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0870AC05027 for ; Thu, 2 Feb 2023 15:34:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vKXzrJCSxSoWipG2uPEwFl6RusS+ayUj6cGL9yOZP+I=; b=r9+jO/c0R+xiuM LGt8CdhIwXRob+CI1tkiLpQjRUjn4ZgJCv10bEV3oCsI9qE5ei4C4LTNZYSQj22clytgA5TKzAAuX c1jfpgDWkBWbfxNjKEGHc5/n8SeKDSGQzTl/URDxWd+TNW4C0YHb78Wrflw/+jThtcbzaaOoIRYQk +VcdmNjYFe2crN1SxIr2Q/gJ7afq47ShD7T0p5WeXNdHvN0wZBpU0QWbEXs7JW3cM0F3xxPb77++b mhNQ3CfZQBgxk+EX4gOUClHA0YNyBKQcBe1HffE/7VcS4FTk0+x1y2aW4qwhLA1y4LQbKTldOQTvF 4uf9QpnBfCNgsf4+ZBOQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNbax-00GQEX-HN; Thu, 02 Feb 2023 15:33:51 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNba1-00GPjX-Cw for linux-arm-kernel@lists.infradead.org; Thu, 02 Feb 2023 15:32:58 +0000 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 E8310B826AD; 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230202_073253_611987_2D9E5F93 X-CRM114-Status: GOOD ( 14.45 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 KH X-Patchwork-Id: 13126407 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D1A8AC05027 for ; Thu, 2 Feb 2023 15:35:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=atrroJLk9/ZAPya7o2BnRzHWxYuJ3LxNMi8aljAmj3g=; b=xgRnk5JibP7f4b 0gVtLRGxF2+KlYfJD9Lfy52bvpK9u6wrIsd9WSxPR2Yaxu/lJGxw2y+9vwBgKGgJtSyDHohNouyww IVP7FmmvzWwfks04VkFulfjr0ZX61XUjCpzPmdOBOO97do6gMNaGXJf6HXEALrKvGfK7WfyC+5/PM uY99Zzaol4cP/Pecw0fZFJW5tuzXCCWoBVe7cksfrHeVn2pS8VcfdLg1lgIztXgzaSvf8OreXV8MY 6RKEUUvrOUgD2vfLqEvNDWZFbvD3I3VOHc08pRjq1kxS/XI6VBRDymH021ewmCbzQp81cBMxJBgPW WebDzDerGtCnjuQqU+WQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNbbs-00GQjv-Ke; Thu, 02 Feb 2023 15:34:48 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNba2-00GPkG-Kg for linux-arm-kernel@lists.infradead.org; Thu, 02 Feb 2023 15:33:01 +0000 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 F398861B8C; Thu, 2 Feb 2023 15:32:53 +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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230202_073254_765966_74B43A81 X-CRM114-Status: GOOD ( 14.59 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 KH X-Patchwork-Id: 13126406 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 50668C05027 for ; Thu, 2 Feb 2023 15:35:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Y3S9GUtIyoBKta0mXLMsbzCX2t0dNn3SRXSRTRH7w/Y=; b=v2fxs6316fItYG EAQtsdjKZib7SdxYLpirh9qIm7QNcP9oNT8ZIuYBwWBPrMxO6pMUhgfixRjjo+wnHqp3Tx28SEFUg AGDNSzo8785QUXBxf0qeyA3iFlwlUQ/qLx5XfpedAW/3P+A8zJIjsQ7nN9lYMRwAr6Dgc2fvG4cc8 h2z7u1JbcxbT87G2NNAsJN9XvMtERMYw5yn+G9Wd1azb0sjIHs7NdcplYOPBjWiFPRxHmIVlrHARw 1qFtexzOz9XTTgyWE/0Z+yYso2+ii7l+Jt9V47EECpCvDbOQM858T2aEQvMcvs3dzb5suQxjttX5y VqP+YgQofet22IZGEZlQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNbbe-00GQbm-KV; Thu, 02 Feb 2023 15:34:34 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pNba5-00GPlt-57 for linux-arm-kernel@lists.infradead.org; Thu, 02 Feb 2023 15:33:01 +0000 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 B4C4661BDF; 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230202_073257_289914_7385BDCB X-CRM114-Status: GOOD ( 14.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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);