* [PATCH net] bnxt_en: Drop oversize TX packets to prevent errors.
@ 2019-02-27 8:58 Michael Chan
2019-02-27 17:30 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Michael Chan @ 2019-02-27 8:58 UTC (permalink / raw)
To: davem; +Cc: netdev
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>
---
David, I think this should be queued for stable as well.
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index d95730c..803f799 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -500,6 +500,12 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev)
}
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);
--
2.5.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH net] bnxt_en: Drop oversize TX packets to prevent errors.
2019-02-27 8:58 [PATCH net] bnxt_en: Drop oversize TX packets to prevent errors Michael Chan
@ 2019-02-27 17:30 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-02-27 17:30 UTC (permalink / raw)
To: michael.chan; +Cc: netdev
From: Michael Chan <michael.chan@broadcom.com>
Date: Wed, 27 Feb 2019 03:58:53 -0500
> 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>
> ---
>
> David, I think this should be queued for stable as well.
Applied and queued up for -stable.
Thanks for following up on this Michael.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-02-27 17:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-27 8:58 [PATCH net] bnxt_en: Drop oversize TX packets to prevent errors Michael Chan
2019-02-27 17:30 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).