netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 5/5] drivers cris: return on NULL dev_alloc_skb()
@ 2006-11-09  3:49 akpm
  2006-11-10 16:09 ` Jeff Garzik
  0 siblings, 1 reply; 2+ messages in thread
From: akpm @ 2006-11-09  3:49 UTC (permalink / raw)
  To: jeff; +Cc: netdev, akpm, rientjes, starvik

From: David Rientjes <rientjes@cs.washington.edu>

If the next descriptor array entry cannot be allocated by dev_alloc_skb(),
return immediately so it is not dereferenced later.  We cannot register the
device with a partial descriptor list.

Cc: Mikael Starvik <starvik@axis.com>
Signed-off-by: David Rientjes <rientjes@cs.washington.edu>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 drivers/net/cris/eth_v10.c |    2 ++
 1 file changed, 2 insertions(+)

diff -puN drivers/net/cris/eth_v10.c~drivers-cris-return-on-null-dev_alloc_skb drivers/net/cris/eth_v10.c
--- a/drivers/net/cris/eth_v10.c~drivers-cris-return-on-null-dev_alloc_skb
+++ a/drivers/net/cris/eth_v10.c
@@ -509,6 +509,8 @@ etrax_ethernet_init(void)
 		 * does not share cacheline with any other data (to avoid cache bug)
 		 */
 		RxDescList[i].skb = dev_alloc_skb(MAX_MEDIA_DATA_SIZE + 2 * L1_CACHE_BYTES);
+		if (!RxDescList[i].skb)
+			return -ENOMEM;
 		RxDescList[i].descr.ctrl   = 0;
 		RxDescList[i].descr.sw_len = MAX_MEDIA_DATA_SIZE;
 		RxDescList[i].descr.next   = virt_to_phys(&RxDescList[i + 1]);
_

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

end of thread, other threads:[~2006-11-10 16:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-09  3:49 [patch 5/5] drivers cris: return on NULL dev_alloc_skb() akpm
2006-11-10 16:09 ` Jeff Garzik

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