netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: roel.kluin@gmail.com
Cc: khc@pm.waw.pl, netdev@vger.kernel.org, akpm@linux-foundation.org
Subject: Re: [PATCH] lmc: Read outside array bounds
Date: Sun, 09 Aug 2009 21:27:25 -0700 (PDT)	[thread overview]
Message-ID: <20090809.212725.218498673.davem@davemloft.net> (raw)
In-Reply-To: <4A7C401B.7090301@gmail.com>

From: Roel Kluin <roel.kluin@gmail.com>
Date: Fri, 07 Aug 2009 16:54:19 +0200

> If dev_alloc_skb() fails on the first iteration of the allocation loop, and we
> break out of the loop, then we end up writing before the start of the array.
> 
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
>> First of all, if we allocated at least one buffer we should
>> mark the last one in the code right after this loop.
>> 
>> Second of all, we should purge the TX skbs in the next
>> loop even if we could not allocate even one RX buffer.
>>
>> The thing to do is probably to guard the set of "[i-1]" RX ring
>> accesses with a "if (i != 0)" check.
> 
> Forgot a bit about this one, but I hope this is what you meant?

It's not correct to limit the TX ring loop by how many RX
ring buffers we've been able to successfully allocate,
that doesn't make any sense.

I'm talking about the second loop which you unexplainably
changed to "for (j = 0; j < i; ..."

I'm not applying this.

  reply	other threads:[~2009-08-10  4:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-25 22:18 [PATCH] lmc: Read outside array bounds Roel Kluin
2009-07-27  1:33 ` David Miller
     [not found] ` <20090728144307.c189810b.akpm@linux-foundation.org>
2009-08-07 14:54   ` Roel Kluin
2009-08-10  4:27     ` David Miller [this message]
2009-08-10 11:29       ` Roel Kluin
2009-08-13 23:27         ` 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=20090809.212725.218498673.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=akpm@linux-foundation.org \
    --cc=khc@pm.waw.pl \
    --cc=netdev@vger.kernel.org \
    --cc=roel.kluin@gmail.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).