Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3471934imu; Sun, 11 Nov 2018 15:53:26 -0800 (PST) X-Google-Smtp-Source: AJdET5d2Uo1Vr10OzDtmtVUVpPdhPkg2uCCmqI1kL24Q8x2q86xBzs83NQo0Oe46y4aKAuIX75P8 X-Received: by 2002:a62:cac4:: with SMTP id y65-v6mr17899819pfk.27.1541980406486; Sun, 11 Nov 2018 15:53:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541980406; cv=none; d=google.com; s=arc-20160816; b=fC/3J2V9rFvYJeE39EjDkzX375pPPz9XSL5dPSx1PEMet1zwKxjX5yr/gMlwfMgdiz mnNcPhf8DOLfk6lb8IVgDQnny1pz2IlXkIrX1vhJfv9Nm6BCimBQNSG5CKz1wnwGTTpW dvKp1jByI3wKMIk2+4NKgC99DSi9LIIXAw2mwZ+FEoo98qyfqZ5yPf1B6xR69BIsH9kf 4i5SBx0r9lRopFbUz5MekeFiaC6xcw43DD+BAWu8x2L2M80mSzbUGpe1QlWYEM7ShsQn o0TATWu+nOMuZpyGhDt/FwB6bZTuGc8DSPVh9pAcQduIU8Fg39n19PW3VY/J36v3n2S4 CaeQ== 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=uZGVP878yGA/PWFVgoxPJ64OsOPRG/k23I7JmLJwhCc=; b=cbL9Y2tEWD1Vz0qX840dpO2fYSUGLZvq49IePePhQ0r91PzkdzlzBnFcntgjaobYmt r8asbbwWkdJD/n3DQL7LIGEv6D9du/LT/xOn40OdBUsPB2tVFgmeIGxLrf/eXt8JfzuI 1/gRnBP1s/Hp2jnfnHAGF3mYr6yOSJkXM2yw19iyO2uWtCezF+xefP7b7SFSZvuUKmXj ZHb8g+oTEGnS0//QbSRIZX2+eDGDtzi3A20Q7ZGL2JGNFgmCPcI4SwJXEw0kf6/TO1wN GBJNPiA+0reK3+ivfL7L13GCtt9ApwW7b57B5QVYWs78+TGjfz9eGOrwS/3oO6N6sJu1 czUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WOwSjIpa; 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 1-v6si16799771plt.225.2018.11.11.15.53.11; Sun, 11 Nov 2018 15:53:26 -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=WOwSjIpa; 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 S1733121AbeKLJm6 (ORCPT + 99 others); Mon, 12 Nov 2018 04:42:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:37238 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732811AbeKLIS1 (ORCPT ); Mon, 12 Nov 2018 03:18:27 -0500 Received: from localhost (unknown [206.108.79.134]) (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 9F3212154B; Sun, 11 Nov 2018 22:28:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975311; bh=hhVpmHAkQIXVN6d7K5F5ShFL+gJCU/LTrEjQkx5Q59o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WOwSjIpa5L9ikWbV0/FoiIhXJE+IEATeg/Wa/OwreuUfqVGepvNS4lzmIs3X0kF4F 9iD36QklIyx5trNRZDKtJ7CEuVPPi/rSwwuL+E3AlBGbl0yjA68OOXQXhhLf/4HIe0 tLNsjQt1n2BYy0XuRX/HfK1py2r8pLNMBOEoBCus= 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 Subject: [PATCH 4.19 292/361] net: bcmgenet: fix OF child-node lookup Date: Sun, 11 Nov 2018 14:20:39 -0800 Message-Id: <20181111221656.775078508@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@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.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Johan Hovold commit d397dbe606120a1ea1b11b0020c3f7a3852da5ac upstream. 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: Greg Kroah-Hartman --- drivers/net/ethernet/broadcom/genet/bcmmii.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/ethernet/broadcom/genet/bcmmii.c +++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c @@ -342,7 +342,7 @@ static struct device_node *bcmgenet_mii_ 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");