Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2908018iog; Mon, 27 Jun 2022 05:32:47 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tUAqRCaob8c1Fp7/Y0OZM0tkHDb+LwkwdnRkiNoQ4SegEAgvJ785QGM/vqNiAnvRfjG6lc X-Received: by 2002:a17:907:7f8d:b0:711:d8db:2714 with SMTP id qk13-20020a1709077f8d00b00711d8db2714mr12811399ejc.63.1656333167548; Mon, 27 Jun 2022 05:32:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656333167; cv=none; d=google.com; s=arc-20160816; b=NIX5uRubhT4oABq1ooeXjP2St6TS9FiusquDCBks+4EmLUzvnKLB8ESFmvA883XPQi /++0pY0FoliNJc+0ldqngsoV7IRq3jtODqukTDOTI2KLaRuRFKq1qnvZRbjlvOYaGZAY qfGlEKX/qeF+njfv0bkjS9u2m5iVaMv1Km5hrz01plPJAQOqK7KxC04szaGjtzYjUaAw T93sLGIs64+OrOdcqvISSXgobDnKnUECbb0CWDjZ+IC2jCucEp+6lpoY7fKn7AoZiSOB z6rTNZRDWmTaMwhYCQAdAdLETnqcmCluoJyEZTd8aqGLaPW1ObbW1yKQu+S75VLcop5a WW+w== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=1q7yc60j7/XqobQSOGVjkiFUTqQxkdX9c/i3mCBZbqE=; b=D3axt916EUqXZpbNr9qnORMMLMZ7lOCAsmD5AqUYbwW43RvPoltd5UiI3I578mL3Wh DlMI2xGTpqJByzczM7DbJ93UH0jI0fh6trli+EHtdmDZ1TI9yBwqL/MDrW8OpqudxEYW TTTG+rdmnLh/9h1fmS4ZwFjP96DvKt/aurNmeZr+Qs5gNXSgTwL0IeUvrq54+SV1PNhi 8qMRt7sOXNx+DNPd7jvfHixB7VK5GKRZk7IPdUotg2TjO+QmFrABiJZQ2WnVlCKI0ODT 5gOnU3CooFUwFWUDI1PFpKG+aKYBqUt4qDxXfi72qOj+BWrknVelL0/U3HajeNwgZ9uV XSXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lO9YyI3d; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ds10-20020a170907724a00b007263713cfdasi12556020ejc.180.2022.06.27.05.32.21; Mon, 27 Jun 2022 05:32:47 -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=@linuxfoundation.org header.s=korg header.b=lO9YyI3d; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235888AbiF0Lfx (ORCPT + 99 others); Mon, 27 Jun 2022 07:35:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236376AbiF0Ldo (ORCPT ); Mon, 27 Jun 2022 07:33:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA57CB50; Mon, 27 Jun 2022 04:31:04 -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 ams.source.kernel.org (Postfix) with ESMTPS id 51F8BB8111B; Mon, 27 Jun 2022 11:31:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BBE36C3411D; Mon, 27 Jun 2022 11:31:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656329462; bh=+PEY8aTgvCN7a4zjWSNtiwwqaicvZrFgs6faUOWbhog=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lO9YyI3dvmlRHkJ3nJAT8CD9VXqnytrEZOfm+oPLQMFIbRLk6qMhs1ajevn22J7s4 uMPdMiYoz0Z7WklBCSwl2+x13umJ66wE58z4whuug+ADtz1q3G84p74luJFnTdWziN yZ6AwHc/FGPDRK2Z1zpVbHKvLudbjwu7KtShVP7o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Andy Shevchenko , Florian Fainelli Subject: [PATCH 5.4 54/60] soc: bcm: brcmstb: pm: pm-arm: Fix refcount leak in brcmstb_pm_probe Date: Mon, 27 Jun 2022 13:22:05 +0200 Message-Id: <20220627111929.279609206@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220627111927.641837068@linuxfoundation.org> References: <20220627111927.641837068@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.5 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: Miaoqian Lin commit 37d838de369b07b596c19ff3662bf0293fdb09ee upstream. of_find_matching_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. In brcmstb_init_sram, it pass dn to of_address_to_resource(), of_address_to_resource() will call of_find_device_by_node() to take reference, so we should release the reference returned by of_find_matching_node(). Fixes: 0b741b8234c8 ("soc: bcm: brcmstb: Add support for S2/S3/S5 suspend states (ARM)") Signed-off-by: Miaoqian Lin Reviewed-by: Andy Shevchenko Signed-off-by: Florian Fainelli Signed-off-by: Greg Kroah-Hartman --- drivers/soc/bcm/brcmstb/pm/pm-arm.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/soc/bcm/brcmstb/pm/pm-arm.c +++ b/drivers/soc/bcm/brcmstb/pm/pm-arm.c @@ -780,6 +780,7 @@ static int brcmstb_pm_probe(struct platf } ret = brcmstb_init_sram(dn); + of_node_put(dn); if (ret) { pr_err("error setting up SRAM for PM\n"); return ret;