[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210111171802.1826324-1-ciorneiioana@gmail.com>
Date: Mon, 11 Jan 2021 19:18:02 +0200
From: Ioana Ciornei <ciorneiioana@...il.com>
To: davem@...emloft.net, kuba@...nel.org, netdev@...r.kernel.org
Cc: Ioana Ciornei <ioana.ciornei@....com>
Subject: [PATCH net-next] dpaa2-mac: fix the remove path for non-MAC interfaces
From: Ioana Ciornei <ioana.ciornei@....com>
Check if the interface is indeed connected to a MAC before trying to
close the DPMAC object representing it. Without this check we end up
working with a NULL pointer.
Fixes: d87e606373f6 ("dpaa2-mac: export MAC counters even when in TYPE_FIXED")
Signed-off-by: Ioana Ciornei <ioana.ciornei@....com>
---
drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
index dd00c5de2115..7cb286e53369 100644
--- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
+++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
@@ -4150,6 +4150,9 @@ static void dpaa2_eth_disconnect_mac(struct dpaa2_eth_priv *priv)
if (dpaa2_eth_is_type_phy(priv))
dpaa2_mac_disconnect(priv->mac);
+ if (!dpaa2_eth_has_mac(priv))
+ return;
+
dpaa2_mac_close(priv->mac);
kfree(priv->mac);
priv->mac = NULL;
--
2.29.2
Powered by blists - more mailing lists