Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3025486rwb; Mon, 15 Aug 2022 16:23:31 -0700 (PDT) X-Google-Smtp-Source: AA6agR6+Qe3Hdh6aP6d1Mz+hpa/66i7C4esjTB6l/Jta+x6zWnWk0fx08plD4IcCAmFPKqGY/kFJ X-Received: by 2002:a17:907:75ee:b0:730:b801:614 with SMTP id jz14-20020a17090775ee00b00730b8010614mr11501526ejc.698.1660605811021; Mon, 15 Aug 2022 16:23:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660605811; cv=none; d=google.com; s=arc-20160816; b=uWo+GzZPs22MshQe8r4PwOgpnN6tN1/SSmAgxhahxf2Q0tRO8Q4mXnqscskQnAXviP 04akEWPWNwQtfy8ulloB8CL7W4El88JfWlHvTT9jFC12sTNCUdtLZ1K46/6rDdOiZls+ +6Y50vnVowdQoz9TDN7sMginkM/sZU/O3kwggWb1U4sqScBW1nY8aj++Wt8gNl1pKyut dYpJk4Y8gNR1Tfc/IIopIch0h3tUp5mt/EDvSTtFoct36pJmWJ8xI66U1Ezw8xR6KRxu ep0r3dO1ODPmKkdkJJ9wQVVUmDe/p4Ry1N8FbigLRglxyANHmGGWBjkyV2Mye8lSb+Wq GcUQ== 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=BoE41Tn8AJTsSjrAMRvU+7/sep5q4S8/qRf3qtw5qLA=; b=OHAOaRNY0X1UIMiDjm97WqlF33uXrwYGkHCzOncHzsJEtcvoQpTnT0I1aEdPv5+woQ rTpm29L6i6wYn1gWMeWmpS7g/Zzh1ihHcw5l8CpPWPPbnTn9O3CJMVgrRs1+WLsmuf4u hqzSGf6aRd1sNAL2p40bWTB5wCBRsHFWMejHipqfYa0rR7+W24nvDNKy2eFXLboME31g 1xfw3Q7H9FfxU+keWFEeFmQh9TqxLuE3pR6ZnOaGmi6vL0SgTiHihKBLCYRMZdnF81ZC XDbtlbFFQJKJcYcmwXkfIF//Qu4NkQemB2mTFkbpcINy+lLIXH9frbMMabfd80P0HkTr Gk6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lFmQYvQ2; 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 d10-20020a056402400a00b004417f8545d5si8397950eda.112.2022.08.15.16.23.06; Mon, 15 Aug 2022 16:23:31 -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=lFmQYvQ2; 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 S1348469AbiHOVd1 (ORCPT + 99 others); Mon, 15 Aug 2022 17:33:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348506AbiHOVb1 (ORCPT ); Mon, 15 Aug 2022 17:31:27 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DD82EF9DD; Mon, 15 Aug 2022 12:24:09 -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 sin.source.kernel.org (Postfix) with ESMTPS id 81E3FCE12C8; Mon, 15 Aug 2022 19:24:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4CEDAC433D6; Mon, 15 Aug 2022 19:24:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660591445; bh=Y2YVxMxFUYn+u8NnVUBKFgPVl4Mn/bDpZE1Y3UP0Zr4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lFmQYvQ2/0KZDe3ipzLp7ilm6R68WObnrpeYYh1GPtGamiUtL/UCcT3ZroelDCjHw /WyMvdRVcru9qJCjHwfFLtcrTiag1NZ2URSoJMt+S3WyXYB+lqUrYpAw6D6XF6+pVt +oxkcwhcs6QqhCRCiY6j6puDNFKZqPfYTtoxrj4I= 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.18 0543/1095] mtd: maps: Fix refcount leak in ap_flash_init Date: Mon, 15 Aug 2022 19:59:02 +0200 Message-Id: <20220815180452.002892916@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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 77087a04c8fd554134bddcb8a9ff87b21f357926 ] 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. 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/20220523143255.4376-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 297a50957356..a1b8b7b25f88 100644 --- a/drivers/mtd/maps/physmap-versatile.c +++ b/drivers/mtd/maps/physmap-versatile.c @@ -93,6 +93,7 @@ static int ap_flash_init(struct platform_device *pdev) return -ENODEV; } ebi_base = of_iomap(ebi, 0); + of_node_put(ebi); if (!ebi_base) return -ENODEV; -- 2.35.1