netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jarek Poplawski <jarkao2@gmail.com>
To: Roel Kluin <roel.kluin@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	netdev <netdev@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH] 3c515: Write outside array bounds
Date: Sun, 26 Jul 2009 23:16:45 +0200	[thread overview]
Message-ID: <4A6CC7BD.9020602@gmail.com> (raw)
In-Reply-To: <4A6B88B1.9000907@gmail.com>

Roel Kluin wrote, On 07/26/2009 12:35 AM:

> if dev_alloc_skb() fails on the first iteration, a write to
> cp->rx_ring[-1] occurs.
> 
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
> Please review: can we error return like this?


I doubt we can return here: there is a lot of cleaning missing.

Jarek P.

> 
> diff --git a/drivers/net/3c515.c b/drivers/net/3c515.c
> index 3e00fa8..c84815a 100644
> --- a/drivers/net/3c515.c
> +++ b/drivers/net/3c515.c
> @@ -827,7 +827,7 @@ static int corkscrew_open(struct net_device *dev)
>  			skb = dev_alloc_skb(PKT_BUF_SZ);
>  			vp->rx_skbuff[i] = skb;
>  			if (skb == NULL)
> -				break;	/* Bad news!  */
> +				return -ENOMEM;	/* Bad news!  */
>  			skb->dev = dev;	/* Mark as being used by this device. */
>  			skb_reserve(skb, 2);	/* Align IP on 16 byte boundaries */
>  			vp->rx_ring[i].addr = isa_virt_to_bus(skb->data);
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 



  reply	other threads:[~2009-07-26 21:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-25 22:35 [PATCH] 3c515: Write outside array bounds Roel Kluin
2009-07-26 21:16 ` Jarek Poplawski [this message]
2009-07-29 14:13   ` Roel Kluin
2009-07-29 20:43     ` Jarek Poplawski
2009-07-30 10:26       ` Roel Kluin
2009-07-30 20:28         ` 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=4A6CC7BD.9020602@gmail.com \
    --to=jarkao2@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --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).