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 5C2E6C7EE33 for ; Fri, 3 Mar 2023 21:49:17 +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=lxaSF5vv7Xhb9YD8oWZ5Jv1F5iObMSmbiqMJtJm7ybo=; b=wRblwQN0/6Xz/G 8JhCwF8CBoJdoseoWOLRPMMs5BI4Kay2ko6gVVaquBSrsdAL0r/yqJ3SaGwAKjknJl4/kFH9A9QED H+I9B0Y2sntS6BzyJturml1+R/r78f2lWVpOIkUPkWuwWm8tUsL/XzNNuFsJSTJcixt9hHYJCED8+ WdSkecjw6O717Qi8nXjxfcvjJiF3Gx1/v6HzoU1e8lKh5oZu5YFSvdCwlHEjoyxdHBIlR/I8ialjF d34MkcZWhzverDJOfUCYO/j/qo45J5d3gEV5D53QyfyPnNoGlxP7QX7W2xHzizeVSus1rTON16Qyp l1JTqZq044tWK/o3fhNQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pYDGE-007YrG-Kw; Fri, 03 Mar 2023 21:48:19 +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 1pYDEl-007Xvp-Jg for linux-arm-kernel@lists.infradead.org; Fri, 03 Mar 2023 21:46:50 +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 2DECEB819F9; Fri, 3 Mar 2023 21:46:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24FEAC4339C; Fri, 3 Mar 2023 21:46:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1677880005; bh=FCr71OfqrNuYpQWh1uNDAto1H/RXTFO0WbB5oEKU0aE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dsAafEmjKAkdrbL8kI3bqAHtZzbxtvRz18E9m1m/zyqOwOyh0sha6VOg4AVOZWCxC ihfLW5gASriQN13uY76NnmXYHS/hLIfpL4KfLrIO5X5dUQYJKQPM/04mwA+IEnRqeS qKbG/6fvz8xWLWlLGqg6Zv69fMgwGVtfJpmlF2mBS9zDc/8+v3UD4eWqOHlDWsBpMD 45ywZsImpR2mDSO9Lk0RHgq1cqlEQka6CPC5ltKzJWCVedZ3ZWZa6gq0E3sf9Zl5gk PEsAWzAt/heYKub4T8WVtTmJTk6FOhg0IFgmmbnMZJSQIREe7hbGBL8cQy+PFf/lTN A7URz0IucLAlQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Daniel Mack , Haojian Zhuang , Robert Jarzmik , Sasha Levin , linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org Subject: [PATCH AUTOSEL 5.15 32/50] USB: gadget: pxa27x_udc: fix memory leak with using debugfs_lookup() Date: Fri, 3 Mar 2023 16:45:13 -0500 Message-Id: <20230303214531.1450154-32-sashal@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230303214531.1450154-1-sashal@kernel.org> References: <20230303214531.1450154-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230303_134647_881214_083FA234 X-CRM114-Status: GOOD ( 13.65 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Greg Kroah-Hartman [ Upstream commit 7a6952fa0366d4408eb8695af1a0578c39ec718a ] 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 Link: https://lore.kernel.org/r/20230202153235.2412790-12-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- 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 f4b7a2a3e7114..282b114f382f8 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 -- 2.39.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel