[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20090726.183326.52668550.davem@davemloft.net>
Date: Sun, 26 Jul 2009 18:33:26 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: roel.kluin@...il.com
Cc: khc@...waw.pl, netdev@...r.kernel.org, akpm@...ux-foundation.org
Subject: Re: [PATCH] lmc: Read outside array bounds
From: Roel Kluin <roel.kluin@...il.com>
Date: Sun, 26 Jul 2009 00:18:17 +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@...il.com>
...
> sc->failed_ring = 1;
> - break;
> + return;
This won't work.
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.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists