From: Robert-Ionut Alexa Date: Mon, 31 May 2021 10:30:04 +0000 (+0300) Subject: dpaa2-eth: fix a possible null pointer dereference X-Git-Tag: rel_imx_5.10.35_2.0.0-somdevices.0~58 X-Git-Url: https://git.somdevices.com/?a=commitdiff_plain;h=3f502a7898c14e921d15a0694307918496d35efe;p=linux.git dpaa2-eth: fix a possible null pointer dereference In case the FD that we are cleaning up on the Tx confirmation path is corrupted (carries a wrong SWA type), there will be no skb to work with. Signed-off-by: Robert-Ionut Alexa --- diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c index 1ee793e2a664..b15c13ed9256 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c @@ -1092,6 +1092,12 @@ static void dpaa2_eth_free_tx_fd(struct dpaa2_eth_priv *priv, return; } + /* If there is no skb (in case of a wrong SWA type) + * just exit the function + */ + if (!skb) + return; + /* Get the timestamp value */ if (skb->cb[0] == TX_TSTAMP) { struct skb_shared_hwtstamps shhwtstamps;