Skip to content

Commit

Permalink
dpaa2-mac: fix the remove path for non-MAC interfaces
Browse files Browse the repository at this point in the history
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: d87e606 ("dpaa2-mac: export MAC counters even when in TYPE_FIXED")
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Link: https://lore.kernel.org/r/20210111171802.1826324-1-ciorneiioana@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
IoanaCiornei authored and kuba-moo committed Jan 14, 2021
1 parent 70b32d8 commit 848c190
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 848c190

Please sign in to comment.