public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Francois Romieu <romieu@fr.zoreil.com>
Cc: nic_swsd@realtek.com, netdev@vger.kernel.org
Subject: Re: r8169 OOPSen in rtl_rx
Date: Wed, 14 Aug 2013 11:52:33 +0200	[thread overview]
Message-ID: <20130814095233.GH24092@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <20130814092915.GF24092@twins.programming.kicks-ass.net>

On Wed, Aug 14, 2013 at 11:29:15AM +0200, Peter Zijlstra wrote:
> diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
> index 393f961..76d1c18 100644
> --- a/drivers/net/ethernet/realtek/r8169.c
> +++ b/drivers/net/ethernet/realtek/r8169.c
> @@ -6185,6 +6185,8 @@ static int rtl_rx(struct net_device *dev, struct rtl8169_private *tp, u32 budget
>  			else
>  				pkt_size = status & 0x00003fff;
>  
> +			WARN_ON(!(pkt_size > 0 && pkt_size <= ETH_FRAME_LEN));
> +
>  			/*
>  			 * The driver does not support incoming fragmented
>  			 * frames. They are seen as a symptom of over-mtu

OK, I changed that to:

diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 393f961..81e0bf4 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -6185,6 +6185,12 @@ static int rtl_rx(struct net_device *dev, struct rtl8169_private *tp, u32 budget
 			else
 				pkt_size = status & 0x00003fff;
 
+			if (!(pkt_size > 0 && pkt_size <= ETH_FRAME_LEN)) {
+				dev->stats.rx_dropped++;
+				printk("%s Funny sized packet: %d\n", dev->name, pkt_size);
+				goto release_descriptor;
+			}
+
 			/*
 			 * The driver does not support incoming fragmented
 			 * frames. They are seen as a symptom of over-mtu

  reply	other threads:[~2013-08-14  9:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-13  9:43 r8169 OOPSen in rtl_rx Peter Zijlstra
2013-08-13 21:15 ` Francois Romieu
2013-08-14  9:29   ` Peter Zijlstra
2013-08-14  9:52     ` Peter Zijlstra [this message]
2013-09-05 15:20       ` Peter Zijlstra
2013-09-05 23:09         ` Francois Romieu

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=20130814095233.GH24092@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=netdev@vger.kernel.org \
    --cc=nic_swsd@realtek.com \
    --cc=romieu@fr.zoreil.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