Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3090120rwb; Mon, 15 Aug 2022 17:53:11 -0700 (PDT) X-Google-Smtp-Source: AA6agR4Eu5S+nGUwWDXWKXsAYaqHKZcRmR291lhiCoCL/XXs0kIId9cbpe1wrkHbVGB2JewtR9yY X-Received: by 2002:aa7:db44:0:b0:43d:267c:edd9 with SMTP id n4-20020aa7db44000000b0043d267cedd9mr16686787edt.385.1660611191579; Mon, 15 Aug 2022 17:53:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660611191; cv=none; d=google.com; s=arc-20160816; b=G5ctM9d3ZovwXf20N/YhqHzhTX3ACVhu1iZSW8oGZhHgvQDFGOgApqiLpTJZtFuCtl oIbkJSO8+J5s/DF0hcBcB8A/FdSaiOkc6iDGn3HWrwENs5I0wv3q7KECpZ/5tkg6ok8a 0vdwRXvgNRjJYw5m77+0I6K+kQYzmvhUCL15Al93E1lVqYruNNEBXgdjfBlH+OF7/m+O sIfgxRNVD6NqU6i9DGB9AKvUcZ+O71FBl97w5gt7VosOb8h9Bsijn0sejZotA5spvkd8 yHDFeMh2gn99iWK1BQ1c9z9FgLg4A9AxQk7MUMwsRMYcr6Lb7hwk0/gRDSkmW4x0j2W3 ocTQ== 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=Ett/ekqDdZGX8mYOoat/ni84ESApOyU8nGz/rmtKwrA=; b=aZFqfewxnfCoMt3Hx3Krsc+rEmuS7CyR02E2Bf2GXkHdZrYeOv4+uKoXqI9FOXqo5k Jp+jSAYyjVzysqw45wYT2ZtoKlyeg+cUoZ5bHpkJDilqh5Og9mdLU2ASWP6VZrsA9nvw TOQgnH39vIEqp6WeedP/rpu+tXlexhgiyY6qhBXJ52NPSdpx3DmvD/Z8lqVcP6QUMjuJ 8pa4oWFQpJ2TECIbC+beMdBFAr7mEFHzr/ckvLgWm4PN14MTmDVNjmowGQJus0F6eDLV 7TbFuYRBDaO3NqIpMCv7mXzMXiCCDvuR5yPvrlBrDByugHXsecsCZewVGwOjf7RsgQlH lC6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=F6QTTQn5; 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 jg26-20020a170907971a00b0072b57c1f238si8485576ejc.291.2022.08.15.17.52.45; Mon, 15 Aug 2022 17:53:11 -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=F6QTTQn5; 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 S1351448AbiHPAJQ (ORCPT + 99 others); Mon, 15 Aug 2022 20:09:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355529AbiHPAAx (ORCPT ); Mon, 15 Aug 2022 20:00:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8B244AD43; Mon, 15 Aug 2022 13:20:47 -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 84ADF60FB8; Mon, 15 Aug 2022 20:20:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86E49C433C1; Mon, 15 Aug 2022 20:20:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594846; bh=dUu8ueBkoD9WU0J+cgsPNoGbfDPcl41stYx5RPPV8tc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F6QTTQn5pvFBFXOkmOboLnmw8hIOXXnyCijKwzHSyyFI1LGV/0vs5hr6ktLJmqh08 IRwz0ohON5lOmcR6/l0EMO3HR+JBJ/+Rjog/T3ii+uWJ1kP9IegHjQeIEXa4wyt5Oo QvYP0532bmqw/f9JIMyMprikoXBMoTCHlgcZuzcE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Linus Walleij , Miquel Raynal , Sasha Levin Subject: [PATCH 5.19 0576/1157] mtd: maps: Fix refcount leak in of_flash_probe_versatile Date: Mon, 15 Aug 2022 19:58:52 +0200 Message-Id: <20220815180502.680990578@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 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 [ Upstream commit 33ec82a6d2b119938f26e5c8040ed5d92378eb54 ] of_find_matching_node_and_match() 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. Fixes: b0afd44bc192 ("mtd: physmap_of: add a hook for Versatile write protection") Signed-off-by: Miaoqian Lin Reviewed-by: Linus Walleij Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20220523140205.48625-1-linmq006@gmail.com Signed-off-by: Sasha Levin --- drivers/mtd/maps/physmap-versatile.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mtd/maps/physmap-versatile.c b/drivers/mtd/maps/physmap-versatile.c index ad7cd9cfaee0..297a50957356 100644 --- a/drivers/mtd/maps/physmap-versatile.c +++ b/drivers/mtd/maps/physmap-versatile.c @@ -207,6 +207,7 @@ int of_flash_probe_versatile(struct platform_device *pdev, versatile_flashprot = (enum versatile_flashprot)devid->data; rmap = syscon_node_to_regmap(sysnp); + of_node_put(sysnp); if (IS_ERR(rmap)) return PTR_ERR(rmap); -- 2.35.1