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