From 3f502a7898c14e921d15a0694307918496d35efe Mon Sep 17 00:00:00 2001 From: Robert-Ionut Alexa Date: Mon, 31 May 2021 13:30:04 +0300 Subject: [PATCH] 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 --- drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 6 ++++++ 1 file changed, 6 insertions(+) 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; -- 2.17.1