Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3708272imu; Mon, 28 Jan 2019 09:23:36 -0800 (PST) X-Google-Smtp-Source: ALg8bN46eYgU14oB8fwXiebD1mCiBdgaz0T0dsWMJ9ScjqC+8NIG7CVVs3eldYAluw26gllr+jhb X-Received: by 2002:a63:4566:: with SMTP id u38mr20429242pgk.4.1548696216809; Mon, 28 Jan 2019 09:23:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548696216; cv=none; d=google.com; s=arc-20160816; b=s+l79ENn8W21qw2jqBWVu1g3v9L15iKvMGVzyfAoU7tIwMsLzvuJ96HBJUTly2ukmB L1Khwjn4KikzQ8qlJ4mGHk7KPSmpg6tWevea3ZVBLw1qSZWZe/yVg5M4YTkwc+p7ewB/ mG1Jun8DjHsjMUmKeJrFal5DRkAKBtukjvjRbBQiDdaABirKgmSt6I16pREpsckW1vCx Med2xUPQ6ZvPdjKPB+p/YfWhr2GxFa3zP4MIIZiQsLCD8rP8TnQNBgmCYbJK8tGkBzsS b6I1aN4u//8oNAlkhnhr9h9zEPDB/wOalMdEAZT8Rdi/MBxaMtP+4HDBhXGA1a65FmaY Xa1g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=C7JX+pJgzDO7Z5dPBpdBMitmJe0CIqIwQkPOlgmtwTY=; b=sNbKEPCwCiv8yfFtkLzXaDBPpFL9wXF4kBS0KgWNNgu5i+mTGKgGBX7p6hFv/aZvyh NfusQEXb+xOAYGMu6lDnTdk9lITH6D2Zq+2onGWayODy5C5Cdj8MQTInUOzjdmWmTQ/v kkkBNlKXD3dQZxm2dYmrLwRqabtPUyQomSNNXrsx7WlsONJHR4dsmDcvJCxCWDxIhcaZ kJjpQiZGf1H8fsofb7xleXz5PUycqGEqiM7e1qzbJYPiDPNr0cNtkCaQ1rrL4yDC26hH nC9xIAvk0wMFeeWKNcAhAaIGh1vdFrFADC55Kp1t53RadT1wV6Am4EUJnfrmWLYmrPjK ZJ5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZHv8EYnx; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u21si1977924pgg.463.2019.01.28.09.23.21; Mon, 28 Jan 2019 09:23:36 -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=ZHv8EYnx; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731370AbfA1QDU (ORCPT + 99 others); Mon, 28 Jan 2019 11:03:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:48616 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730646AbfA1QDT (ORCPT ); Mon, 28 Jan 2019 11:03:19 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5A9042082E; Mon, 28 Jan 2019 16:03:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548691398; bh=vM/HZ0kX+YyQxTYP1blajf8bADyrGwjoPo2pZPWGeak=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZHv8EYnxUjybW6U0qe5xAr1DXzdOD/rNLLX0jp0z+VzLjVKU6kmTqIzNxc3ikPbHN s/kvtb0gBt/9Cavx/dzCmCH0L15j7nxcFfGNaXjcGeDu3mFkzZ4eFjUEOrmqEf99a0 VJ9I4PRznyMZMiPFn51e6hLuNMrntXXdIJmQwrYc= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Yangtao Li , Florian Fainelli , Sasha Levin Subject: [PATCH AUTOSEL 4.19 080/258] soc: bcm: brcmstb: Don't leak device tree node reference Date: Mon, 28 Jan 2019 10:56:26 -0500 Message-Id: <20190128155924.51521-80-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190128155924.51521-1-sashal@kernel.org> References: <20190128155924.51521-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yangtao Li [ 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 14185451901d..bf9123f727e8 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; } u32 brcmstb_get_family_id(void) -- 2.19.1