enetc: Fix NULL dma address unmap for Tx BD extensions
authorClaudiu Manoil <claudiu.manoil@nxp.com>
Wed, 15 May 2019 16:08:56 +0000 (19:08 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 15 May 2019 16:14:29 +0000 (09:14 -0700)
For the unlikely case of TxBD extensions (i.e. ptp)
the driver tries to unmap the tx_swbd corresponding
to the extension, which is bogus as it has no buffer
attached.

Signed-off-by: Claudiu Manoil <claudiu.manoil@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/freescale/enetc/enetc.c

index 5bb9eb35d76d1b697d65634b755d1a1239415d31..491475d87736ca5de2bf0fc418cab53e06b1fc26 100644 (file)
@@ -313,7 +313,9 @@ static bool enetc_clean_tx_ring(struct enetc_bdr *tx_ring, int napi_budget)
        while (bds_to_clean && tx_frm_cnt < ENETC_DEFAULT_TX_WORK) {
                bool is_eof = !!tx_swbd->skb;
 
-               enetc_unmap_tx_buff(tx_ring, tx_swbd);
+               if (likely(tx_swbd->dma))
+                       enetc_unmap_tx_buff(tx_ring, tx_swbd);
+
                if (is_eof) {
                        napi_consume_skb(tx_swbd->skb, napi_budget);
                        tx_swbd->skb = NULL;