Received: by 2002:a17:90b:8d0:0:0:0:0 with SMTP id ds16csp4883492pjb; Mon, 27 Jul 2020 07:32:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwC9UaTsUA+jFslpYNoOb1UqYAk2z3nmul6koMQlIsttfm9w9tlZkJvWkpeZC2whC5Xe7ad X-Received: by 2002:a17:906:c04d:: with SMTP id bm13mr20903022ejb.321.1595860365276; Mon, 27 Jul 2020 07:32:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595860365; cv=none; d=google.com; s=arc-20160816; b=LqVypjIhkIRq5kadIlo8IzfZmbYh1a5hG0QkGujWfpIgR+of3pObqEzRBYTjBmVZEq jwXikRL0wLC2+p7Ov3TEPAZlzBB7OwJO7c8L04mRC6E63dOUGGmLSq7C1hvUy2D/+IRL yFObGGRZAmjSBCVP8r0g79UEdItbnggsgevzFT24eAJDE0sfBW0HHeQWQf/ahker5683 VZU+WkWCBjr/mtzDVjXgrhVg5GpGiQSsygw64KMY5LYVzCjngIUpWFG6eRPUQtRdvkJF ndw8LMvILNhWGkr655yKtn9y6UHD0JpjVpa5ujQOo2pJvMoeuvGZbT2/kCyF8sV+egd+ f1wA== 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=pOZ35xp4q+zJZhm2dbTcl95vHmy+jJM+wRYFfHwTdl8=; b=YZ2mC20bps6Y+4EaJ8NcM34lXV5dEriwYhayUz1KvbKqB4sEQMHqFYlBgm0o29anje gl9N2AwmjHvSP3oByth92Zec++5zaQEcR7nii7gEHt+iAJFhanGOVSYDWVueEinW3oPR aTPvJhsV/TOf/jKKXBb0SEeJ0jN4maKtbPe6EOegVtrrRRI4SeNgmON8nkYI5VcxTepL KkFCy2JjAQ4sKjiJCVRXN3HexkkQ2ctf1uGgJ9XjCIAQS9/CJP1gs5RrTp8e3NIhRqGc vv4v5JySyWwh2nw3jYj4JxBtT3omu+4I+n3PSe+nWCN+/ahCCk97Cr4RW4vIZqV9bYFV /7Jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=glilwNrp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id sa7si6212592ejb.564.2020.07.27.07.32.23; Mon, 27 Jul 2020 07:32:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=glilwNrp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731698AbgG0ObF (ORCPT + 99 others); Mon, 27 Jul 2020 10:31:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:49590 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731660AbgG0OVE (ORCPT ); Mon, 27 Jul 2020 10:21:04 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 8B00E2070B; Mon, 27 Jul 2020 14:21:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595859664; bh=fWgkcWHZ5S4Hy6H2qIaWgZq9/peitARfUWaqCkpTLzQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=glilwNrpGiexzIpCjeDQcZQjbiyHEj6B6Ax2Tby5ekuFVnHAbDKtM0jzPr7as1ecR hTosoQOThCa6pfxRJWZOF0YukEnm/7kYDfgmW2ZyTzIWSIhw5SBujD4X8+ESWSA5Er Vc/Bg6C/y0Y8A0VnkKl9fSMDTw+oh+KhgZVtd/Js= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ioana Ciornei , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.7 050/179] dpaa2-eth: check fsl_mc_get_endpoint for IS_ERR_OR_NULL() Date: Mon, 27 Jul 2020 16:03:45 +0200 Message-Id: <20200727134935.105780439@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200727134932.659499757@linuxfoundation.org> References: <20200727134932.659499757@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Ioana Ciornei [ Upstream commit 841eb4012cef84820e5906527b31a854f42b0748 ] The fsl_mc_get_endpoint() function can return an error or directly a NULL pointer in case the peer device is not under the root DPRC container. Treat this case also, otherwise it would lead to a NULL pointer when trying to access the peer fsl_mc_device. Fixes: 719479230893 ("dpaa2-eth: add MAC/PHY support through phylink") Signed-off-by: Ioana Ciornei Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c index 569e06d2bab21..72fa9c4e058f7 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c @@ -3383,7 +3383,7 @@ static int dpaa2_eth_connect_mac(struct dpaa2_eth_priv *priv) dpni_dev = to_fsl_mc_device(priv->net_dev->dev.parent); dpmac_dev = fsl_mc_get_endpoint(dpni_dev); - if (IS_ERR(dpmac_dev) || dpmac_dev->dev.type != &fsl_mc_bus_dpmac_type) + if (IS_ERR_OR_NULL(dpmac_dev) || dpmac_dev->dev.type != &fsl_mc_bus_dpmac_type) return 0; if (dpaa2_mac_is_type_fixed(dpmac_dev, priv->mc_io)) -- 2.25.1