Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3413583rwa; Tue, 23 Aug 2022 04:29:52 -0700 (PDT) X-Google-Smtp-Source: AA6agR43kRL1id4jbUpRgpZ8VP78ciy7wXAgyEMMY/WsqbWHdE9f0cDFTlgXYBC5HJca0NqwC8GL X-Received: by 2002:a17:90b:3805:b0:1fb:75d4:59d4 with SMTP id mq5-20020a17090b380500b001fb75d459d4mr19165pjb.209.1661254192149; Tue, 23 Aug 2022 04:29:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661254192; cv=none; d=google.com; s=arc-20160816; b=mbSilDwkX8GY70qsmj6o8DOx/51TRwRZZsdhXDdUz+zMnZw5rvSlPd6rA3vPAMJi5t Nt0zZ4jq73CVGVjcsc+PJfXGUPdfCzD126nv8cABO8GQb8Q9kRVEm7Y+9HxUvUvEIelz nTlPvkV6Tp1mSkDgw+fEci3pWJ5lJfcGjjU4nV5MQNy4lBU2eeAXfrKmvNmc76oOKLM5 LBBh5JawluWHaVZ0YXkCwqQ5gZuhxFHDMedGMNA9L8SpHdGtfICght4PpINfxuEQyo+X O5ILVDUKbmwZmi+ZOqC5kSuJchByY/5h0JJKeY4MDZqeSeh01N3228fyK3RqCFxcHhxC WR6w== 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=zAnJ81H7H7k+zxBBJzZJwuK3xJQqIijnZSvj/RIrW4I=; b=mf2XsX6QCmBXEirkpDMS+Vx6I1AJS9S24mA6iLbJvWNfqPjsJlIBzko1xVAIPYU4q+ hDjm2o7N3SR3gThNTLilSYYd0HoMzW1X4M/kocPu8hTm/8lNIDbuYdYZPpK/uPoa53a0 80DkU0K29Wg6mNG9bn3zlWl0j23vCz+0U9uxkntGwD6ThorZSfL60dyp00MtzT3+V8o2 KBXF3mhA81/2NuUkYOT95OXGtBQyv4wEazuZIU82AUuIOnmWGZ+lyZXN2rOU1q1+oqXo wk8dDTKIkpg0qJG4xfyhdkm8M8N/SiaLr+/7fx3YPrN54Bmrk5pA2PeEAoiyhOkQvFM1 wu/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Qwy3h5S2; 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 w3-20020a634903000000b0042ac7cd3c55si3784173pga.165.2022.08.23.04.29.41; Tue, 23 Aug 2022 04:29:52 -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=Qwy3h5S2; 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 S242542AbiHWJrd (ORCPT + 99 others); Tue, 23 Aug 2022 05:47:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241550AbiHWJnT (ORCPT ); Tue, 23 Aug 2022 05:43:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DAE19A952; Tue, 23 Aug 2022 01:42:37 -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 1F6BC614E9; Tue, 23 Aug 2022 08:42:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25345C43470; Tue, 23 Aug 2022 08:42:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661244155; bh=gXJeB+CKeDu7TiKFHWZPHO1BsLZegk9X3IBL5reKvkk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qwy3h5S2xz65uIXq1HogwKneRIQpuFjg0dLbT7Dbma3uj6DMFQ8aFBBh3Hsi+luqM R9PScrulSBilUbQjc4URtYtC9JBcouhZc4z6ac/pMjOcxTGqmaep3W+6CGDv01Upio vwe0M6XAtIriAzkX/smdI6kiiG7avFtyBe9Y2aJw= 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 4.14 094/229] mtd: maps: Fix refcount leak in of_flash_probe_versatile Date: Tue, 23 Aug 2022 10:24:15 +0200 Message-Id: <20220823080057.068334279@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080053.202747790@linuxfoundation.org> References: <20220823080053.202747790@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_of_versatile.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mtd/maps/physmap_of_versatile.c b/drivers/mtd/maps/physmap_of_versatile.c index 03f2b6e7bc7e..961704228dd2 100644 --- a/drivers/mtd/maps/physmap_of_versatile.c +++ b/drivers/mtd/maps/physmap_of_versatile.c @@ -221,6 +221,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