From: Florian Fainelli <f.fainelli@gmail.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, pgynther@google.com,
Florian Fainelli <f.fainelli@gmail.com>
Subject: [PATCH net-next 3/3] net: systemport: Add a check for oversized packets
Date: Thu, 28 May 2015 15:24:44 -0700 [thread overview]
Message-ID: <1432851884-12026-4-git-send-email-f.fainelli@gmail.com> (raw)
In-Reply-To: <1432851884-12026-1-git-send-email-f.fainelli@gmail.com>
Occasionnaly we may get oversized packets from the hardware which exceed
the nomimal 2KiB buffer size we allocate SKBs with. Add an early check
which drops the packet to avoid invoking skb_over_panic() and move on to
processing the next packet.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/ethernet/broadcom/bcmsysport.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index d777b0db9e63..909ad7a0d480 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -638,6 +638,14 @@ static unsigned int bcm_sysport_desc_rx(struct bcm_sysport_priv *priv,
p_index, priv->rx_c_index, priv->rx_read_ptr,
len, status);
+ if (unlikely(len > RX_BUF_LENGTH)) {
+ netif_err(priv, rx_status, ndev, "oversized packet\n");
+ ndev->stats.rx_length_errors++;
+ ndev->stats.rx_errors++;
+ dev_kfree_skb_any(skb);
+ goto next;
+ }
+
if (unlikely(!(status & DESC_EOP) || !(status & DESC_SOP))) {
netif_err(priv, rx_status, ndev, "fragmented packet!\n");
ndev->stats.rx_dropped++;
--
2.1.0
next prev parent reply other threads:[~2015-05-28 22:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-28 22:24 [PATCH net-next 0/3] net: systemport: misc improvements Florian Fainelli
2015-05-28 22:24 ` [PATCH net-next 1/3] net: systemport: Pre-calculate and utilize cb->bd_addr Florian Fainelli
2015-05-29 3:43 ` Petri Gynther
2015-05-28 22:24 ` [PATCH net-next 2/3] net: systemport: rewrite bcm_sysport_rx_refill Florian Fainelli
2015-05-29 3:58 ` Petri Gynther
2015-05-29 4:02 ` Florian Fainelli
2015-05-28 22:24 ` Florian Fainelli [this message]
2015-05-29 4:00 ` [PATCH net-next 3/3] net: systemport: Add a check for oversized packets Petri Gynther
2015-05-31 6:51 ` [PATCH net-next 0/3] net: systemport: misc improvements David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1432851884-12026-4-git-send-email-f.fainelli@gmail.com \
--to=f.fainelli@gmail.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=pgynther@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).