netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] lmc: Read outside array bounds
@ 2009-07-25 22:18 Roel Kluin
  2009-07-27  1:33 ` David Miller
       [not found] ` <20090728144307.c189810b.akpm@linux-foundation.org>
  0 siblings, 2 replies; 6+ messages in thread
From: Roel Kluin @ 2009-07-25 22:18 UTC (permalink / raw)
  To: khc, netdev, Andrew Morton

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>
---
diff --git a/drivers/net/wan/lmc/lmc_main.c b/drivers/net/wan/lmc/lmc_main.c
index 45b1822..ac8d5b2 100644
--- a/drivers/net/wan/lmc/lmc_main.c
+++ b/drivers/net/wan/lmc/lmc_main.c
@@ -1865,7 +1865,7 @@ static void lmc_softreset (lmc_softc_t * const sc) /*fold00*/
             if(skb == NULL){
                 printk(KERN_WARNING "%s: Failed to allocate receiver ring, will try again
", sc->name);
                 sc->failed_ring = 1;
-                break;
+                return;
             }
             else{
                 sc->lmc_rxq[i] = skb;

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-08-13 23:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2009-08-10 11:29       ` Roel Kluin
2009-08-13 23:27         ` David Miller

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).