Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp252606ybi; Wed, 29 May 2019 20:41:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqwBe7HUxhDoVcMwX27DWnPDFIghPd5IPZlYAA/7em9cYUumQTdKkCQhvc4WksDgEFUKlnkl X-Received: by 2002:a62:386:: with SMTP id 128mr1648633pfd.10.1559187719766; Wed, 29 May 2019 20:41:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559187719; cv=none; d=google.com; s=arc-20160816; b=McMXtFeFb1LKaP5jToYSs/0zQI0EKRQeHFm7IBwfjUs0t0bOdMPIK1Sa1gpS5L66X6 sy7TnlRa8OtcLkdoTnxD2f7sVK+AvR5puyiKFq+Mf04NyXOdVQQU61vYImFDp51uGf2e NNLhd5fBUYVahdxbUHpZThWzXvdJuezQGbbfjftb022ObBqUJIq39W5kdEMlo5kRynj4 yh2eFssTVEJ1puiXf/gA4V/TVzyv4ETenF9pipXDLsK+c0ppCsfcJyVQdzBuzs/eEVlG QUKq2q8GLaR/CPGRDhAzrU8afFLmNsaPp993IYVSNmRFDZ0VieAPYHlqNQ0mY8M6Jgr8 0YxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Jtp7AM4aVOIXigWpStDEGYHxyiv8aKvSdZNE7V2SnZc=; b=ru0dgYJIF2SQM5CITiz4eKcb7LE3sUeyuKuQb3t4VjmQDTGD8pTTEuRr9joWLJLYNB LizaNfYqEzjl1q/PJScclY1tRj+WI0mkPYItJ8MpNyq7KDT2ykLytGACGyzt9B3sEBOI szZ0qKNbb++4iyHr+ehFOzBmswsFhJ2zMNe6h178M+XlfQMhLSrke49XhAnaM8VYXklS FDulZHqXKTVnIY4dPmAEPogOL+A7glJsUyE4nq6U7zqpqubCqvoO0nUiXz5T8em4OgpB iBo7vxPKfsuI+9oFzjNWPQWpWHYE+9i72dDeU0SkJdqVlbkOYsch7HDRCWCrbWeiek4x 8zCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jCf721i2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b12si2082053pgl.77.2019.05.29.20.41.42; Wed, 29 May 2019 20:41:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jCf721i2; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732062AbfE3Dkg (ORCPT + 99 others); Wed, 29 May 2019 23:40:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:34838 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731428AbfE3DV1 (ORCPT ); Wed, 29 May 2019 23:21:27 -0400 Received: from localhost (ip67-88-213-2.z213-88-67.customer.algx.net [67.88.213.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2707B249FC; Thu, 30 May 2019 03:21:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559186487; bh=VJkP1uPKZV04dqxxoe5F7J+u19z62vXuWKURf8fiC+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jCf721i2BKK+2IUcSdSjPwhIe2kC1l/iX7HtkbeqyI6JazOCH66GgZydEFNG3zUiF Jf4yyDh1AFEUjA08jaJRraJViyyBd6gkGlaH5Kh6VVTQh+feMs8oNR4OomoCD4fUDh GZX86/neXbBipiV0MT/Rq2N/Ln3QVBEuZ2Ehca34= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wen Yang , "Rafael J. Wysocki" , Viresh Kumar , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , linux-pm@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Sasha Levin Subject: [PATCH 4.9 087/128] cpufreq: pmac32: fix possible object reference leak Date: Wed, 29 May 2019 20:06:59 -0700 Message-Id: <20190530030450.494881621@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190530030432.977908967@linuxfoundation.org> References: <20190530030432.977908967@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 8d10dc28a9ea6e8c02e825dab28699f3c72b02d9 ] The call to of_find_node_by_name returns a node pointer with refcount incremented thus it must be explicitly decremented after the last usage. Detected by coccinelle with the following warnings: ./drivers/cpufreq/pmac32-cpufreq.c:557:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 552, but without a corresponding object release within this function. ./drivers/cpufreq/pmac32-cpufreq.c:569:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 552, but without a corresponding object release within this function. ./drivers/cpufreq/pmac32-cpufreq.c:598:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 587, but without a corresponding object release within this function. Signed-off-by: Wen Yang Cc: "Rafael J. Wysocki" Cc: Viresh Kumar Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Michael Ellerman Cc: linux-pm@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Viresh Kumar Signed-off-by: Sasha Levin --- drivers/cpufreq/pmac32-cpufreq.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/cpufreq/pmac32-cpufreq.c b/drivers/cpufreq/pmac32-cpufreq.c index ff44016ea0312..641f8021855a7 100644 --- a/drivers/cpufreq/pmac32-cpufreq.c +++ b/drivers/cpufreq/pmac32-cpufreq.c @@ -551,6 +551,7 @@ static int pmac_cpufreq_init_7447A(struct device_node *cpunode) volt_gpio_np = of_find_node_by_name(NULL, "cpu-vcore-select"); if (volt_gpio_np) voltage_gpio = read_gpio(volt_gpio_np); + of_node_put(volt_gpio_np); if (!voltage_gpio){ pr_err("missing cpu-vcore-select gpio\n"); return 1; @@ -587,6 +588,7 @@ static int pmac_cpufreq_init_750FX(struct device_node *cpunode) if (volt_gpio_np) voltage_gpio = read_gpio(volt_gpio_np); + of_node_put(volt_gpio_np); pvr = mfspr(SPRN_PVR); has_cpu_l2lve = !((pvr & 0xf00) == 0x100); -- 2.20.1