Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2922104rwb; Mon, 15 Aug 2022 14:06:37 -0700 (PDT) X-Google-Smtp-Source: AA6agR6kuxxSfenejokSXgaTFydeM7tqsBjJuvQ3BGH0fGmtYTPNCb+EAWZ9tM1FixD1Pke/EvFF X-Received: by 2002:a05:6402:28ca:b0:43b:5235:f325 with SMTP id ef10-20020a05640228ca00b0043b5235f325mr15930434edb.320.1660597597501; Mon, 15 Aug 2022 14:06:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660597597; cv=none; d=google.com; s=arc-20160816; b=InPR3s2y6MtxITC406F+6i3z1Z4wq5+wbQwa28Wdy/KpQzJfy1QcnRF+GDBlzfQEmU biP/Rt6TIaZJ7SFYpWjmXI9cb5ocow4ZEnXj6DC+y3HohtbiOjcDNDuSa8pJJAVt+WX7 6axC0Ag9IvYDfufHYzTujp3EQCCC6q1/qpQD9xeXX5Jt2BG05rx5t9U4MmezWCF32FFM Tii7ttMSN7+q8CMwkRXkYN/0p9HF+I08sDNg1z/TDV6IppwqzXgFR4J+c3lHgU7D9IHT /F6WCwhLgmeiGSFakCAGZSeq11zpw1QYycggBJ0BFlkZFMCusRVPWFI4kry29hK7qCo7 HgOw== 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=Q71ZSSmzgIK6yasGqqpAnpKYGDuJw1BFfBNDxCA8gIY/ozZC6pdn2d7K/BgPEYYxYQ Bw7ciJUoTAGWoJ/Cu4+YZ6O1yRMhg5iMqzJwDVG9mOTkfbXqPG6gh+EAFfravoHNXXXT uz6afr7rRGCkINYs1KEF1z3FIi25yRz3f9x86JnqfKHrZIjtLpzxkNgPdpCf2mcrJB8E 9mofeL1N2lOjpTrCfbjO8fg+4g7d32NzBzVPc5AXRn6hQmcINtPQLl8JWbM+v6gtKG5y qEg+wyWbmaVsTTj5wDIqWXyvPsQbTCABXs0Ob4I6SPqjheX0p4VbIg/I2un8yQB4VRyR Z7Nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="MQKI4iC/"; 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 g10-20020a50ec0a000000b0043d2569d289si7494290edr.390.2022.08.15.14.06.11; Mon, 15 Aug 2022 14:06:37 -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="MQKI4iC/"; 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 S245417AbiHOTHT (ORCPT + 99 others); Mon, 15 Aug 2022 15:07:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245679AbiHOTCf (ORCPT ); Mon, 15 Aug 2022 15:02:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A38C4D158; Mon, 15 Aug 2022 11:33:42 -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 39737610A5; Mon, 15 Aug 2022 18:33:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D118C433D7; Mon, 15 Aug 2022 18:33:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588420; bh=dUu8ueBkoD9WU0J+cgsPNoGbfDPcl41stYx5RPPV8tc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MQKI4iC/1C8UVIKMVoDy9BJn1PPgJLC8kdypMdv0HscM8754s1PviccqN5/0WSSkW /aArTsyuiuXoSDM93wlaAVp41a5MYFZyBuHSi1jeRajL6z5fQ2bUuGdQ662AUmMKVM yv4VnVxmFEq6UGKiFKAeifTiq/Tl5/K1GvMw7Oso= 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.15 390/779] mtd: maps: Fix refcount leak in of_flash_probe_versatile Date: Mon, 15 Aug 2022 20:00:34 +0200 Message-Id: <20220815180353.963800547@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@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