Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3334894rwa; Tue, 23 Aug 2022 03:04:33 -0700 (PDT) X-Google-Smtp-Source: AA6agR6e+Ch41Y7mjhsZpPaFXI0jFi+3QmfXuRVKenxtA6UdM9k3a6vnMhUhFmFRnNdn95Bp7LdT X-Received: by 2002:a17:907:8a07:b0:731:48ba:792e with SMTP id sc7-20020a1709078a0700b0073148ba792emr15798573ejc.397.1661249072969; Tue, 23 Aug 2022 03:04:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661249072; cv=none; d=google.com; s=arc-20160816; b=XgtRpJ+/1XW5LG3+VuZXGlVyIpooa/yf8Cs75tKMwtOlBMNJltvzLaBwmZ1K+/jD3G ZULPP8UjAlBRy2csnP66smFiQROnQHd0c5rsm4jQoi60sx8B9lRgVZqfY4L4GOVFmi4+ efnMckEBRTN0EiWxXM9IBBR/EcBxbLl/xu3+DvG/i0auscz5T50xd2oNJ6YiMk4eShvU BNaX79455HSZfv7srTu8xR3LMAdrKyI7xFVJwjtH6dnS9wXz9tPPGSiAxC337V9dNtHc AxXUFR+VEBDO0NT4hxaafteAUq1ckhwy9PEcxU0GvDbZPQVKj31YFUX4q1kU++ZYK3b6 tKyA== 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=Kx7c1lpuueach+bH6LWalmHVv1XDljrNSLeVZM0zhkA=; b=MHPsQo3ACnTTsMv9A0BkMvQwH5w36GJiemPNGDiSQw4cc2q62R9/fyNnaJ0aWcUsDI 7N+SmqFVhQNoC/RRUipWvuT9CxocZgAPNBiITamO5EboSYwR/R+Z4y0vXNGhYLPW9j8F K+dGadEj4X8EyP/tzHXnykh2bak4sdTYXoLIDGYv+GpU31RvyuSVhifzc8v8XiQZXK6u zg9DXJOYQZsYYsm1215yfGxJOcku5Il2mt6oaPee32p33yVuSSKoNIdjhB/+Q+cIEWu5 RGt0OA57fXOQUrqlA19asCd3hDVHjAFGResny6uRxifFGLWrHC41m/lw4yQHbgS+HzbG p5gQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=LymkP6Xv; 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 cw21-20020a170906479500b007263a6115adsi11337292ejc.893.2022.08.23.03.04.06; Tue, 23 Aug 2022 03:04:32 -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=LymkP6Xv; 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 S241048AbiHWJtl (ORCPT + 99 others); Tue, 23 Aug 2022 05:49:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240307AbiHWJq7 (ORCPT ); Tue, 23 Aug 2022 05:46:59 -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 98B339C2D7; Tue, 23 Aug 2022 01:44:24 -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 4BCE3611DD; Tue, 23 Aug 2022 08:43:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4EAF8C433C1; Tue, 23 Aug 2022 08:43:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661244202; bh=bVQGyZY1n80bSzC1lyAdzRMkB8EVvkQLixSXwGrJx/8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LymkP6XvBH03SRpCIyGAty/vRhwrIdf3CrhEdXd/2jHC+E/81rz8acCYtDgTtDPIz C1RCUgnoE7GZYyPUg5d9cm9bK+rDtXuP92vAGE0RsOhLuL5NYIvNvA6IqPW5dcixk4 yAI6EUq9+8bj6SwVQM4N6/napNRZAaJwTUEwi+R4= 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 4.14 102/229] mmc: sdhci-of-esdhc: Fix refcount leak in esdhc_signal_voltage_switch Date: Tue, 23 Aug 2022 10:24:23 +0200 Message-Id: <20220823080057.336974286@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 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 3f00a7fc79b5..6bb1f4ad0216 100644 --- a/drivers/mmc/host/sdhci-of-esdhc.c +++ b/drivers/mmc/host/sdhci-of-esdhc.c @@ -671,6 +671,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