Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2920068rwb; Mon, 15 Aug 2022 14:04:26 -0700 (PDT) X-Google-Smtp-Source: AA6agR66nCq3h/XrdJQe7K4oHkHB5MNd2ylVCrIXznabTjItB3J/nxWyXm/22SfVgdgzuINHcxSd X-Received: by 2002:a17:906:cc4a:b0:730:850f:5cb5 with SMTP id mm10-20020a170906cc4a00b00730850f5cb5mr11849006ejb.658.1660597466690; Mon, 15 Aug 2022 14:04:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660597466; cv=none; d=google.com; s=arc-20160816; b=lx92DWIc++2d1t1ynQyzK0qWGz+BhxuAPKcpd9SR0YrwJF+3D1puj1uGGM8F+Ky7fZ EPr16ECUJ/mOpKn9zhlUWZQgx8+0/7BwVIMBMpXJnHkMY0AsrQsTi/fN4B5/bJUM1w4l 5SCE+mSKvevudKE16frt2EBCnPz/CDo3v9NfCPGbeZ6+DWzrEYpUyj8HEMCKf5n345iT Qa4WO+rDkEYhkRM0Tu7H6SVFirlnkyvFaQ+6GMHA34etHY9B5+z6EP4y4deu4uH2+aLA N5EQYdvZH0k/zsLHNf6Dl7rpUhBBof8QPdu5QHsDJdLosTWveusByRCPXdhqzZY6uLIY mPwg== 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=psAFcIwGmC6dECpzUQkmTdlvpzxcVQBgikIqWUR4wws=; b=Ue6OcKpfZ9lCc77faFRDDJqKkobvrZivIkh4UeDsP5+kxZ88OC5SwXjpWjNKrCZ6k9 Eamg5k/8RQSZMp1Ua+U6p0QzDKmJiToN9mmnxh/gPgSOcfb+G+dlff0eIOvWZsLUnYSv jdIdhyF3yMYO/DQI2NVqnus1WPm3KwUaV+KmRMF6x2wR8IsD0ZINrxDNPek9/VpuM5Ac THCKjKKZgTfeCCaVgXPaRPAP/DQ9S8MkxhORg4/HIkPOxaXtqZprvkgwOnbGOrXKKMQw PCCheP51psy7TAlQ3iMCthyGMQ6ECpizhRPVIWC8M2c/zLxN1j5ys8t0QUinurOj7195 2MnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=wTagRhAY; 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 hz6-20020a1709072ce600b0072a477a55e0si10313851ejc.369.2022.08.15.14.04.00; Mon, 15 Aug 2022 14:04:26 -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=wTagRhAY; 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 S244242AbiHOTSe (ORCPT + 99 others); Mon, 15 Aug 2022 15:18:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344110AbiHOTPp (ORCPT ); Mon, 15 Aug 2022 15:15:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F4EE3C8C5; Mon, 15 Aug 2022 11:37:48 -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 E14F961124; Mon, 15 Aug 2022 18:37:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CCA99C4314B; Mon, 15 Aug 2022 18:37:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588666; bh=23kjo+ZyjcPrClieeyY9KVDu2cu6m5ks6/6ZF6W79Iw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wTagRhAYFTtG0MPnQ/s/l/zuhpanh8GzeFyneKEKiBginfrSt1CoRS7HIWPRL4qu4 Adk/RsC7PhA7EB2aCbbX5UZrYUug3POc1BTgmCRVuHw1d58UrNkV++7iHE8PvfCA+n KNC9MM8fO8BKdAeDUChbXFSvV8gKzEtx1mLyuAd8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Ulf Hansson , Sasha Levin Subject: [PATCH 5.15 476/779] mmc: sdhci-of-esdhc: Fix refcount leak in esdhc_signal_voltage_switch Date: Mon, 15 Aug 2022 20:02:00 +0200 Message-Id: <20220815180357.629409233@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 b5899a3e2f783a27b268e38d37f9b24c71bddf45 ] 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. of_node_put() checks null pointer. Fixes: ea35645a3c66 ("mmc: sdhci-of-esdhc: add support for signal voltage switch") Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220523144255.10310-1-linmq006@gmail.com Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin --- drivers/mmc/host/sdhci-of-esdhc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c index 0f3658b36513..04a37fd137ee 100644 --- a/drivers/mmc/host/sdhci-of-esdhc.c +++ b/drivers/mmc/host/sdhci-of-esdhc.c @@ -904,6 +904,7 @@ static int esdhc_signal_voltage_switch(struct mmc_host *mmc, scfg_node = of_find_matching_node(NULL, scfg_device_ids); if (scfg_node) scfg_base = of_iomap(scfg_node, 0); + of_node_put(scfg_node); if (scfg_base) { sdhciovselcr = SDHCIOVSELCR_TGLEN | SDHCIOVSELCR_VSELVAL; -- 2.35.1