Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1681080rwb; Sun, 14 Aug 2022 09:23:38 -0700 (PDT) X-Google-Smtp-Source: AA6agR5uLYc4PBSHplBkH6Vniu00nScq05i9dCdri8WiSUBy6y05KpjDaR4DfR8Gip1F6xnE8UXS X-Received: by 2002:a05:6a00:1f8b:b0:52d:5b9e:3ecf with SMTP id bg11-20020a056a001f8b00b0052d5b9e3ecfmr12669143pfb.48.1660494218009; Sun, 14 Aug 2022 09:23:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660494218; cv=none; d=google.com; s=arc-20160816; b=atxgr252CEu1j8kSXiHei3dsobsu9ViWWKyn75diKecyU2I8fUPfC9xa4o2KqhMc/8 hS9bQrrpao6+rYx3LF1zkYtXw6E+8KYIZ/AtmfBcwZyRTwY/sycD7phUQGBUjLc2rQuY Zw7mxYfDPSwJqdUh1g+rj9bVmdkE/cwVNe3K3aywChhaVSSVBivYCzyNEAiPjB29Nk/W yUr/fwuTLRT2qcU9XMsfpkgWdCyfBdkFHD0WTX7E7H40SE7Y3f00/QkZcm1/pnejfZ8i GE0vfvxdE0IOEDm/fILZLDyEflwwT++AL691PVu8gTSYZPYCSxfUzJUhfIu6uw/+Xfyy jk+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ETGeoDmma1bgLjpqLJWQqxkxSXeDhYO2AX1TNXnrRtQ=; b=Mt1ESjlOxHvUXbt651aqbzf5tpGWNxbN4mOuZDPSPTuswTAo29kRCZLb97kaFKZE2E Z9HVXyaXdTlBRTpoScjmdcnOTZ0DSnaCqf3xwBg97Npv3o6TBQjrJAip0+vheGXbAq/T RvVGxORnxrlZSyInJmxt0w8w1pjIXBU63y3BqZIm8jsZge2UGM20aHDeBMF0g+D2YsTs SrdXtjlI2CfDFEcx7nCL3PtenJiQykQ5GPuwC/EG4VyXW62DYndQPwv81/9fvZUn3y9U WyaI3bDFx44fC4oCsgj3apgwoBND+5iaha09052C6ydnmIc6rsPnAD6JvQu7SpPa+uNG XrKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OesOOnRa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i15-20020a170902cf0f00b0016c281b1de3si7379495plg.501.2022.08.14.09.23.25; Sun, 14 Aug 2022 09:23:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OesOOnRa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240410AbiHNP33 (ORCPT + 99 others); Sun, 14 Aug 2022 11:29:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240031AbiHNP2k (ORCPT ); Sun, 14 Aug 2022 11:28:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2B05BC8E; Sun, 14 Aug 2022 08:28:39 -0700 (PDT) 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 6FBF360C13; Sun, 14 Aug 2022 15:28:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3ECB9C433C1; Sun, 14 Aug 2022 15:28:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660490918; bh=9krYIMZkWByFYm0Z2MCMjTdo/cKY77hHZASSi3Elm3k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OesOOnRag/2Q8agSCo1NL1jCeQm6ISjpTE7whxpyFHBf6XCV8LMip6LD1IuyVfTEA T4Q/arV3lVZQ462Oe+bLlHOgrVGZJPGqlflXcSWAaOg85yGbdjGOjifNf8Vew+eTHu GTnHmVeh7+PhVGmncsVUldyXSvd7QJK66yYIoTv1oAbc3jgjZSrZUXd31ZEpBFY1p9 FB3BxPdMj58ZQpttxIzrbymF9ZnUvmhTAJcWojAlx5bhZH/wUw/zmuZzi/+k3dLYry zz8+wcagmZKnMNrHk+Qs2KDYwSkln8BHf0I7YZPxEP5bcJ/uIL4RJTALQYgX5c65jX 7jeUJEDqsf6Aw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Liang He , Greg Kroah-Hartman , Sasha Levin , linux-usb@vger.kernel.org Subject: [PATCH AUTOSEL 5.19 21/64] usb: renesas: Fix refcount leak bug Date: Sun, 14 Aug 2022 11:23:54 -0400 Message-Id: <20220814152437.2374207-21-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220814152437.2374207-1-sashal@kernel.org> References: <20220814152437.2374207-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Liang He [ Upstream commit 9d6d5303c39b8bc182475b22f45504106a07f086 ] In usbhs_rza1_hardware_init(), of_find_node_by_name() will return a node pointer with refcount incremented. We should use of_node_put() when it is not used anymore. Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220618023205.4056548-1-windhl@126.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/renesas_usbhs/rza.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/usb/renesas_usbhs/rza.c b/drivers/usb/renesas_usbhs/rza.c index 24de64edb674..2d77edefb4b3 100644 --- a/drivers/usb/renesas_usbhs/rza.c +++ b/drivers/usb/renesas_usbhs/rza.c @@ -23,6 +23,10 @@ static int usbhs_rza1_hardware_init(struct platform_device *pdev) extal_clk = of_find_node_by_name(NULL, "extal"); of_property_read_u32(usb_x1_clk, "clock-frequency", &freq_usb); of_property_read_u32(extal_clk, "clock-frequency", &freq_extal); + + of_node_put(usb_x1_clk); + of_node_put(extal_clk); + if (freq_usb == 0) { if (freq_extal == 12000000) { /* Select 12MHz XTAL */ -- 2.35.1