]> Git Repo - linux.git/commitdiff
bnxt_en: Drop oversize TX packets to prevent errors.
authorMichael Chan <[email protected]>
Wed, 27 Feb 2019 08:58:53 +0000 (03:58 -0500)
committerDavid S. Miller <[email protected]>
Wed, 27 Feb 2019 17:27:21 +0000 (09:27 -0800)
There have been reports of oversize UDP packets being sent to the
driver to be transmitted, causing error conditions.  The issue is
likely caused by the dst of the SKB switching between 'lo' with
64K MTU and the hardware device with a smaller MTU.  Patches are
being proposed by Mahesh Bandewar <[email protected]> to fix the
issue.

In the meantime, add a quick length check in the driver to prevent
the error.  The driver uses the TX packet size as index to look up an
array to setup the TX BD.  The array is large enough to support all MTU
sizes supported by the driver.  The oversize TX packet causes the
driver to index beyond the array and put garbage values into the
TX BD.  Add a simple check to prevent this.

Signed-off-by: Michael Chan <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
drivers/net/ethernet/broadcom/bnxt/bnxt.c

index d95730c6e0f20a9b1bd5987796bf790e1ea8ac32..803f7990d32b304f7516beaab2a3ed133fa6ca32 100644 (file)
@@ -500,6 +500,12 @@ normal_tx:
        }
 
        length >>= 9;
+       if (unlikely(length >= ARRAY_SIZE(bnxt_lhint_arr))) {
+               dev_warn_ratelimited(&pdev->dev, "Dropped oversize %d bytes TX packet.\n",
+                                    skb->len);
+               i = 0;
+               goto tx_dma_error;
+       }
        flags |= bnxt_lhint_arr[length];
        txbd->tx_bd_len_flags_type = cpu_to_le32(flags);
 
This page took 0.06653 seconds and 4 git commands to generate.