netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] 3c515: Write outside array bounds
@ 2009-07-25 22:35 Roel Kluin
  2009-07-26 21:16 ` Jarek Poplawski
  0 siblings, 1 reply; 6+ messages in thread
From: Roel Kluin @ 2009-07-25 22:35 UTC (permalink / raw)
  To: David S. Miller, netdev, Andrew Morton

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?

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

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

end of thread, other threads:[~2009-07-30 20:28 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:35 [PATCH] 3c515: Write outside array bounds Roel Kluin
2009-07-26 21:16 ` Jarek Poplawski
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

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