Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp263200ybi; Wed, 29 May 2019 20:56:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqxuGNvW9gBcPK5jUfX+kqMqRgTQjK+7+63JeGmN3NAJLD6PEx5Pr0Z2ZXgdaOOBJyiKKt9A X-Received: by 2002:a62:5801:: with SMTP id m1mr1697117pfb.32.1559188571761; Wed, 29 May 2019 20:56:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559188571; cv=none; d=google.com; s=arc-20160816; b=ak9iDiXbMZv8g21wBqU9j5Se736ZKuS+nEE9517XdyJh43vhweUo/k87L7w+sh4LDS 0oyQqSywMomNirRY1xs1KZaYDXUEPA+2zrQdmLsRB/AVVoELl2aXe3bQshiBAL4dZNt4 lyLruvxxj6mBcgeA0Gvk65sYsKVUb3NLZrM18PW21cwecbATJXXQYoKkXeWgFrNYBk76 Tdn9iygpTcqhkpJWQjZ2grMmkXmv69c8XTakA78RHfBINlZlGyZbGzlzoOJjBtfKETmP Q6YUCNCbWKbs6RH9Y+lfWDvjadL4mkPrUiL1jqKNqvrRLfvjyjdaXpUp6MApgR94CL8n 4/aw== 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=BzK7QoaULlLqzWudnM1iu0NZb/2bAjdxllVAhtFdZTH7S58onKRd0mlMIyWhyrhLcL mh/HgjpfPg6daagubsS8etxrCJH0e9UENUb/Ap69cbv/gMynDEBvfXOqOSrsHjvBl6Pn +Voti51kfDS1r2wmYsdY/g9oFgK6cU3j127rrfyz3vL1/6O4BOOREwuXCqvxF/0Y1yFT +YKm8EjT2W1G4Ga8eRgiyWRa2xfErwMrR28X68rdztKk+wynecWXBmBOPrPCOqVM0SfY rpbkhKUKEYsQI82fVVhPQh15aJ96jUbQqkblGUD0IBQD5KYQIYk/e/GjTsADYIOjYobt 6nWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uH82h4yP; 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 x21si2203105pfa.48.2019.05.29.20.55.56; Wed, 29 May 2019 20:56:11 -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=uH82h4yP; 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 S1733064AbfE3Dwy (ORCPT + 99 others); Wed, 29 May 2019 23:52:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:55742 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730594AbfE3DTe (ORCPT ); Wed, 29 May 2019 23:19:34 -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 AB19124879; Thu, 30 May 2019 03:19:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559186373; bh=k8XCWb3nVGyoshzNZpVRJe/i8quHXBLiNB8Xg/6kpDo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uH82h4yPgMpMkBurhOMiV6jh6o5A8eXUa2VxSTu9ZuugLZg2uwuckXqXlWEPbPd/6 vPuf44+UZ95nTBVSl55BLfR3xHqe/cRwB22wPtkHbWedp+J8Y6Pb9fzIfE0M6/zy0Q +2+GtyCmyqISjYLoZWN6LUD+nnf2j7z0psqlXMiA= 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.14 132/193] cpufreq: pmac32: fix possible object reference leak Date: Wed, 29 May 2019 20:06:26 -0700 Message-Id: <20190530030506.796645818@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190530030446.953835040@linuxfoundation.org> References: <20190530030446.953835040@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