Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2649625imj; Mon, 11 Feb 2019 06:27:58 -0800 (PST) X-Google-Smtp-Source: AHgI3IZzhfbZmrRwz5rDosKYPh4sIgYfO0ar1NZlerCJfG8AgGG0BmNNFnfhZKgN/JhwE/7o0EmU X-Received: by 2002:a17:902:622:: with SMTP id 31mr37045865plg.171.1549895278160; Mon, 11 Feb 2019 06:27:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549895278; cv=none; d=google.com; s=arc-20160816; b=IXvJxUfyMmodgyt0ai+lkS0SvyTOmNihwBib9tXZuavEwugSUNdP7f3qgrw5zmofKw 87xCS3JQ9DXXco8hNLaLx8HDQtVieRF3yAcOpypC1rTbN8dl2puv3hwOTlkTRoNF7fCc XcwHmFBiM/a7Tgph85rRYsb0eVk+54+yfLiDnGw1PJ527IjaIrODnAS69mFNPZJuB7kw TUn9aXJJvhenbfT/aar0Cy8ITZFbQ6+Nzjmmbg7qyGxM7rU3iIp7GLWhRIMgmXkkQ1/r PofJk0RGKw2CZ+sAbiUMAUfNSVbWibaaCzEdolf55hg28dJhof38Hf/sz/gFgM4Q873o egvQ== 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=jBkMfGMv4jC3hNs5ZrsEIcKK0gQV3dduvyFJm8FBfz8=; b=kGSG+HpxnU94rfGWhQ5yGuXsHwm27tYmiglyksOMKsJoIOGrXqZGKWvg1Ok5qYekAt Ioe6XcCOl/snWOwC6uj0q6oKKsZQ+u59Ke06SE5TJctRtDtKh5sy5A0275MDhARafCBt lWsScqRIk3QODkobNhxKQYP6B2x9TYYbMmhpZQM6w27vfFye4ya684rv//uzBXl1MDC7 zlEeRXQAHR/EFvd5L/Hn8fbtqVdWErQVpzYWZ0YbqT8sIF7Bz37gpLjfIH+5XbHDW1hT bZxAWaPQMD2CN6chGNQwqDEmqyJ+BKB4asYles3Wwdxn8ovUN+iLTOVB36kLUjDRQ8FV hQPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=M2nVj2sx; 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 m63si10810661pld.132.2019.02.11.06.27.41; Mon, 11 Feb 2019 06:27:58 -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=M2nVj2sx; 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 S1729286AbfBKOYv (ORCPT + 99 others); Mon, 11 Feb 2019 09:24:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:58102 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729242AbfBKOYs (ORCPT ); Mon, 11 Feb 2019 09:24:48 -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 EDE2920821; Mon, 11 Feb 2019 14:24:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895087; bh=u3MOgmOtwIW87rkuKCih30XLb8uFK6dtM+VyM69JsGg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M2nVj2sxQSvpNzKN9+QNuGepP+9eChHt9c0wpmZ46RXysuOKZg99cs2Kh0YkLKkpq +5cuOvYAvPVnc8W2+vIhCC6pI8bmFrYONGvvd2kywk2WqhgL3BgESapoyc3d6hEXO1 VF2aE2vOOcW/phKcyHbJtir1oWtVIEwduO9ZYBT0= 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.20 088/352] soc: bcm: brcmstb: Dont leak device tree node reference Date: Mon, 11 Feb 2019 15:15:15 +0100 Message-Id: <20190211141851.525310475@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@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.20-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 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