Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2552083imu; Thu, 29 Nov 2018 06:47:24 -0800 (PST) X-Google-Smtp-Source: AFSGD/U3wJRGWShXp3f3s66v/m9OZ9cAbSg4s3ZVvehufBx5dR+nMm7glmpPx+pnvbqkfetq/u7h X-Received: by 2002:a63:dd15:: with SMTP id t21mr1411471pgg.347.1543502844554; Thu, 29 Nov 2018 06:47:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543502844; cv=none; d=google.com; s=arc-20160816; b=QaxdxRATyq/knJUlMCxTOjJVTer4OiUlh2VLXNoO2DI02rIUYhGASxu3S4bk41bLDv ViLlltjrLRfpnzstjS0Mh+ZXJv6p7/3MFwZ9j34i/6APbS9iOatA4Y/mJDhxrX05zDaN XTK65OR5/Iit0YfrhFZ/m6j3pQ2sBsYRayUGrJDT+CHnXhM2k7CmVIT68WofnbK+0iFR q/URypqKpig4oHTVmkXd839pDiSRUBdfbgVn73P7xCDVj6GzoK1p63g11uCN7llmUHxy fHFsSU0d1Wv12QSHVyuT/Fg97umFGjTsXh58HNIuz+DHVJm0KqKC20Glx1q+KdS7a/+w NOKg== 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=t6aoT0D5g58kKdKvXBnHj6+xBAGz6IFXlnnLcfGPz/A=; b=by+dNoHKfY7+qL/dxhxPx5ILuugTG94mZjqOLTh5uIAgVhlFXjzBpt9FLD86vwca7N mpKf5CzuNj+y9uL0+zu3kqAOh65003b43EibgNBDEdEyBZ8KfRLSSjV7nZgcKBfQX7df 96wcT/CZT7Nm25X/Tb4J9OSmsZ2ZbnLqjVUkxLvvoX+BbKQ2budaNvY5eo+uYTMpcgbM BRgIWzsNg1b2IB1W8zAjeynkyZ9dFEA4Zv4bX53I8RUXXYjrneEZZfhwUZOCQZWYVomn Ndpon21ALpBX1Jd294Vxu0ol4hbr12sTA6n8Vl40S5OsrPrawrHnOswYZ1sKCCg+T7fi 2whw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=i6eTsylP; 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 i20si2211955pgh.187.2018.11.29.06.47.09; Thu, 29 Nov 2018 06:47:24 -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=i6eTsylP; 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 S2387489AbeK3BcW (ORCPT + 99 others); Thu, 29 Nov 2018 20:32:22 -0500 Received: from mail.kernel.org ([198.145.29.99]:60444 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731758AbeK3BcV (ORCPT ); Thu, 29 Nov 2018 20:32:21 -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 4CFC1213A2; Thu, 29 Nov 2018 14:26:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1543501608; bh=/BvzpZENmPifSNh770tpLP6tzJBeZckolCQ6U6aV0hY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i6eTsylPIDUgKka9+q1nk83pEtqbM4uHhM3cHOkNxE6AxE1aqsSU82x5c9KZ1M+Pj fR0ZukInyFKfP/tl8DDS556MDPPWvZcpj9hY3XOElJroWJhyw3RS4MikYDkz1xgo9x wS3z50eVaaf++FPrnY8q7gX9t5P8LTin7pz8+THc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "David S. Miller" , Florian Fainelli , Johan Hovold , Rob Herring , Sasha Levin Subject: [PATCH 4.14 067/100] net: bcmgenet: fix OF child-node lookup Date: Thu, 29 Nov 2018 15:12:37 +0100 Message-Id: <20181129140104.702561383@linuxfoundation.org> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20181129140058.768942700@linuxfoundation.org> References: <20181129140058.768942700@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 d397dbe606120a1ea1b11b0020c3f7a3852da5ac ] Use the new of_get_compatible_child() helper to lookup the mdio child node instead of using of_find_compatible_node(), which searches the entire tree from a given start node and thus can return an unrelated (i.e. non-child) node. This also addresses a potential use-after-free (e.g. after probe deferral) as the tree-wide helper drops a reference to its first argument (i.e. the node of the device being probed). Fixes: aa09677cba42 ("net: bcmgenet: add MDIO routines") Cc: stable # 3.15 Cc: David S. Miller Reviewed-by: Florian Fainelli Signed-off-by: Johan Hovold Signed-off-by: Rob Herring Signed-off-by: Sasha Levin --- drivers/net/ethernet/broadcom/genet/bcmmii.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c index abbd2894f870..c421e2753c8c 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmmii.c +++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c @@ -360,7 +360,7 @@ static struct device_node *bcmgenet_mii_of_find_mdio(struct bcmgenet_priv *priv) if (!compat) return NULL; - priv->mdio_dn = of_find_compatible_node(dn, NULL, compat); + priv->mdio_dn = of_get_compatible_child(dn, compat); kfree(compat); if (!priv->mdio_dn) { dev_err(kdev, "unable to find MDIO bus node\n"); -- 2.17.1