netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roel Kluin <roel.kluin@gmail.com>
To: khc@pm.waw.pl, netdev <netdev@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH] lmc: Read outside array bounds
Date: Sun, 26 Jul 2009 00:18:17 +0200	[thread overview]
Message-ID: <4A6B84A9.7020506@gmail.com> (raw)

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;

             reply	other threads:[~2009-07-25 22:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-25 22:18 Roel Kluin [this message]
2009-07-27  1:33 ` [PATCH] lmc: Read outside array bounds 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

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=4A6B84A9.7020506@gmail.com \
    --to=roel.kluin@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=khc@pm.waw.pl \
    --cc=netdev@vger.kernel.org \
    /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).