]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
bnxt_en: Drop oversize TX packets to prevent errors.
authorMichael Chan <michael.chan@broadcom.com>
Wed, 27 Feb 2019 08:58:53 +0000 (03:58 -0500)
committerBrian Maly <brian.maly@oracle.com>
Sat, 11 May 2019 00:51:08 +0000 (20:51 -0400)
Orabug: 29516462

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 <maheshb@google.com> 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 <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 2b3c6885386020b1b9d92d45e8349637e27d1f66)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
drivers/net/ethernet/broadcom/bnxt/bnxt.c

index 5a15d28d43531d9e0be02e3bb045d727f7839f0d..61d0dceff3a938e4e1365417572f0ba47f6b4ab7 100644 (file)
@@ -458,6 +458,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);