Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2723233imj; Mon, 11 Feb 2019 07:31:46 -0800 (PST) X-Google-Smtp-Source: AHgI3IazGvzye+04o9B9YQ0zNVHFcHRzjGF1A67whPXUztgl74vAMyZ3j6fpMUQLgIuGQTaYsWS7 X-Received: by 2002:a63:cc4e:: with SMTP id q14mr33723515pgi.291.1549899106646; Mon, 11 Feb 2019 07:31:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549899106; cv=none; d=google.com; s=arc-20160816; b=BpoLHmanE0giAckACoyO2BL9eyk0deU1aB9mYIGkPkCxqNQZ2xdcxCGl1dVyPD0AOg xU/c7peDJGf5GdHCS5yPNnM+rSG0O4qChNYVVNy8zeYmIOiXzYLoSJIMqWcgTXG7DEjf cEQgMcW76cgr6miBXubRKQVuO40m1J3JOaFx8vB3yfFzOnPosE+8aMWgHQbx3S+eUFDU MPCKI73K10UahMgSCwI9TbMKWF8fdvxC+UXM+wTfIxknqjrED8HSjXeZD+2N0dUSwYXl 9vEritLoJn/Jm4aTaa1d7Enx4fA+Tu/C0r065kNuMYym/azJayHqnzaXTHhlyMlF0byd CDvA== 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=W2+ZN/krk9n3CCF92ybaPYuYFEruMxQ77n0mwQxrkbU=; b=0YvNeS0aQqtbz3H/WD4XKJAqnPyIDGDRes8eW7NfF//NH9qE1R653yJP43HISyirDg dqGVN4s3XhVqPWwyl3/bCoZbYF/dyrKp/bA8HcLvv7goLkUxaxckGSuI+qYAL6iRuJ9I XEHEkUpSQ9ahiu4m2W2cf2t7XeUMtuUj7NurKSXTy5H6gMViUPvIPcMKVCxSnbyjwGzh RRe14XruG0gNUFQB2l/V0NKDh3Zus6Eqi0iQBZKhWmv4u9G8giVyVXEk8/fSPDZSCfbk PZpFZaTLwqjMVv9vqKxjUE0zVjPpGARQx0+L8/Sm9N+KhsPvZqUpQmtdeLAiM/2MNQcH cotA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1ZZ3SAI6; 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 h3si9643708pgc.354.2019.02.11.07.31.29; Mon, 11 Feb 2019 07:31:46 -0800 (PST) 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=1ZZ3SAI6; 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 S2387486AbfBKPab (ORCPT + 99 others); Mon, 11 Feb 2019 10:30:31 -0500 Received: from mail.kernel.org ([198.145.29.99]:43488 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389138AbfBKO4S (ORCPT ); Mon, 11 Feb 2019 09:56:18 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (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 404E0222A6; Mon, 11 Feb 2019 14:56:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549896977; bh=Y0dPi2mGIr5JlGUHcaSd429BMEAK2AjaFAiU6XL8lRw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1ZZ3SAI6BvxqVzW64pAkGexAdYSQ2m/DokWmn3zQle+LkJp9XMFpvFRTGYp2gvv2r t0Gbh3dQf50ntsDatgCc3fCCwj6P8kys+tO4y+EFsIcDyht98e6i0uY2gBBOfQj/2F WowNsdldzIC18F4HctdVI2hz8RAyn5+Nxw55WTFs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yangtao Li , Florian Fainelli , Sasha Levin Subject: [PATCH 4.14 049/205] soc: bcm: brcmstb: Dont leak device tree node reference Date: Mon, 11 Feb 2019 15:17:27 +0100 Message-Id: <20190211141832.058445058@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141827.214852402@linuxfoundation.org> References: <20190211141827.214852402@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 1861a7f07e02292830a1ca256328d370deefea30 ] of_find_node_by_path() acquires a reference to the node returned by it and that reference needs to be dropped by its caller. soc_is_brcmstb() doesn't do that, so fix it. [treding: slightly rewrite to avoid inline comparison] Fixes: d52fad262041 ("soc: add stubs for brcmstb SoC's") Signed-off-by: Yangtao Li Signed-off-by: Florian Fainelli Signed-off-by: Sasha Levin --- drivers/soc/bcm/brcmstb/common.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/soc/bcm/brcmstb/common.c b/drivers/soc/bcm/brcmstb/common.c index 22e98a90468c..2f5ec424a390 100644 --- a/drivers/soc/bcm/brcmstb/common.c +++ b/drivers/soc/bcm/brcmstb/common.c @@ -31,13 +31,17 @@ static const struct of_device_id brcmstb_machine_match[] = { bool soc_is_brcmstb(void) { + const struct of_device_id *match; struct device_node *root; root = of_find_node_by_path("/"); if (!root) return false; - return of_match_node(brcmstb_machine_match, root) != NULL; + match = of_match_node(brcmstb_machine_match, root); + of_node_put(root); + + return match != NULL; } static const struct of_device_id sun_top_ctrl_match[] = { -- 2.19.1