Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp241171ybi; Wed, 29 May 2019 20:27:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqzjwzFQtqmKIX7o3zWL4VAmlRXryzna7y69aieeSY9iNP+k5mhZBpPjNHgZnZUy0cDfFWWi X-Received: by 2002:a63:1622:: with SMTP id w34mr1676651pgl.45.1559186870423; Wed, 29 May 2019 20:27:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559186870; cv=none; d=google.com; s=arc-20160816; b=Wf/ZFuZZiBvuJO7kW6KEKFzw5jF9SKuy40nYZxuyZpZ8oj93UmR1RvvMaXIZe1jn5i YLkUNEkoVA7rsuXktaPkHU1LUrMM73nsEQIsAtuWYmwa0eoXUOlRE7P05zIqN5q1I7fE ncCfUmik/Td+aFAx/d5I+VuSsqXGozOYeLZVB4G+6bNCYtGfgBnPQ95HkfRBZsBpfQZn z643+ZVpC5XEye81ehOZvi8ZsPv7j0LZNGp/bag+Zh5sUN5Y3FiSbvhMzll6dznQOrD4 cpsiaiY2ypA515K3pOjrBYY3pftxvJ+cITs1EAsrdP2xkMbyVMmWnz85qAgo3AtVdFvm /YaA== 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=Ssxts364VJW0eTxsQe/WRvfCGW5KZTbExvnZLYjzYEw=; b=wmJtuJPnhtedYrrzyf2Fb5lCRbGtoolhreX9Vb6N+hr9BLzg1wD76soogdArzC5Xqj pys/3qJ9bCZeXmo40VJl5j6YHu+lYZUce1lbvJgOe4VOVMWGz/2aKYonzUuXmtBPpFZF wyDLNlT0EjOYMrHhA6Ioho2y/ucCzsB6LtbRCM50i+aFk3C1dY0vl1kuSBIJ43ozI03L aGmU/qWeFMbCV6pagkWik3Xpp8O9VfPu55RvKGYvSmISJaDnSqhaXObOIdJ1zTOU709T mFl/gtPoIrympCD6ZjgKdDl2/A8poUUdjVQjBrMWf8B8TYBUYJX6AxxtoLUFV1un7YIQ yeTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=veU8EiFA; 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 z9si1945510pgh.21.2019.05.29.20.27.32; Wed, 29 May 2019 20:27:50 -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=veU8EiFA; 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 S1733250AbfE3DYU (ORCPT + 99 others); Wed, 29 May 2019 23:24:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:49448 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730488AbfE3DR7 (ORCPT ); Wed, 29 May 2019 23:17:59 -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 9ED942474C; Thu, 30 May 2019 03:17:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559186278; bh=k8XCWb3nVGyoshzNZpVRJe/i8quHXBLiNB8Xg/6kpDo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=veU8EiFA6prP/BzDTrW4Ot1c7HdIXeM3LWllA5ob/k6xYZE6PUOQf1W6KETcLYvna A/2B2/4qRywBioVzNBaCaijj8XUbXeQW1VfLB3cRkvQ85/5i16pg+7Ar9ZEk1KtG5v BaXMwd5ugzPFekJm7XmjK84EJu5IuKMm0lCti9sw= 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.19 181/276] cpufreq: pmac32: fix possible object reference leak Date: Wed, 29 May 2019 20:05:39 -0700 Message-Id: <20190530030536.601129220@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190530030523.133519668@linuxfoundation.org> References: <20190530030523.133519668@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 61ae06ca008e7..e225edb5c3593 100644 --- a/drivers/cpufreq/pmac32-cpufreq.c +++ b/drivers/cpufreq/pmac32-cpufreq.c @@ -552,6 +552,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; @@ -588,6 +589,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