netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "François romieu" <romieu@zoreil.com>
To: Neil Horman <nhorman@tuxdriver.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net,
	eric.dumazet@gmail.com, nhorman@redhat.com
Subject: Re: [PATCH RFC] r8169: straighten out overlength frame detection
Date: Mon, 28 Dec 2009 22:31:14 +0100	[thread overview]
Message-ID: <20091228213114.GA24285@zoreil.com> (raw)
In-Reply-To: <20091228195053.GB18422@hmsreliant.think-freely.org>

(I'm back)

The Mon, Dec 28, 2009 at 02:50:53PM -0500, Neil Horman wrote :
[...]
> frames were received on NIC's supported by this driver.  This was mentioned in a
> security conference recently:
> http://events.ccc.de/congress/2009/Fahrplan//events/3596.en.html

Is there a paper ?

> It seems that if we can't enable frame size filtering, then, as Eric correctly
> noticed, we can find ourselves DMA-ing too much data to a buffer, causing
> corruption.  As a result is seems that we are forced to allocate a frame which
> is ready to handle a maximally sized receive.

Either that or the switch does not allow jumbo frames.

> I've not tested the below patch at all, and clearly it stinks to have to do.
> But I thought it would be worth posting to solicit comments on it.
[...]
> diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
> index 60f96c4..42e3b22 100644
> --- a/drivers/net/r8169.c
> +++ b/drivers/net/r8169.c
> @@ -3972,7 +3973,7 @@ static struct sk_buff *rtl8169_alloc_rx_skb(struct pci_dev *pdev,
>  
>  	pad = align ? align : NET_IP_ALIGN;
>  
> -	skb = netdev_alloc_skb(dev, rx_buf_sz + pad);
> +	skb = netdev_alloc_skb(dev, 16383 + pad);

I doubt that we will be able to allocate that much memory reliably for long.

I'd rather go for static buffers + copy (+ src mac address of our new friend).

Is it enough if I write it in a pair of evening ?

-- 
Ueimor

  reply	other threads:[~2009-12-28 21:31 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-28 19:48 [PATCH RFC] r8169: straighten out overlength frame detection Neil Horman
2009-12-28 19:50 ` Neil Horman
2009-12-28 21:31   ` François romieu [this message]
2009-12-28 23:49     ` Neil Horman
2009-12-29  0:24     ` David Dillow
2009-12-29  1:20       ` Neil Horman
2009-12-29  0:51     ` Ben Hutchings
2009-12-29  1:16       ` Neil Horman
2009-12-29  1:29         ` Ben Hutchings
2009-12-29 15:35     ` Neil Horman
2010-01-05 13:57 ` [PATCH RFC] r8169: straighten out overlength frame detection (v3) Neil Horman
2010-01-05 15:15   ` Eric Dumazet
2010-01-05 20:40     ` David Miller
2010-01-05 21:38       ` Neil Horman
2010-01-05 21:45         ` David Miller
2010-01-05 22:04           ` Neil Horman
2010-01-07  1:01       ` Francois Romieu
2010-01-07  1:15         ` David Miller
2010-01-08 23:48           ` Francois Romieu
2010-01-09  0:02             ` David Miller
2010-01-10  1:57               ` Ben Hutchings
2010-01-10 23:50                 ` Francois Romieu
2010-01-11  6:45                   ` David Miller
2010-01-12  0:16                     ` Francois Romieu
2010-01-12  6:24                       ` David Miller
2010-01-26 22:07                         ` Brandon Philips
2010-01-30 21:50                       ` Neil Horman
2010-02-18 19:37                         ` Brandon Philips

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=20091228213114.GA24285@zoreil.com \
    --to=romieu@zoreil.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@redhat.com \
    --cc=nhorman@tuxdriver.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).