All of lore.kernel.org
 help / color / mirror / Atom feed
* [Bridge] [PATCH] bridge: check kmem_cache_create() error
@ 2007-04-07  9:57 Akinobu Mita
  2007-04-09 18:55 ` Stephen Hemminger
  0 siblings, 1 reply; 2+ messages in thread
From: Akinobu Mita @ 2007-04-07  9:57 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: bridge

This patch checks kmem_cache_create() error and aborts loading module
on failure.

Cc: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>

---
 net/bridge/br.c         |    7 ++++++-
 net/bridge/br_fdb.c     |    4 +++-
 net/bridge/br_private.h |    2 +-
 3 files changed, 10 insertions(+), 3 deletions(-)

Index: 2.6-mm/net/bridge/br.c
===================================================================
--- 2.6-mm.orig/net/bridge/br.c
+++ 2.6-mm/net/bridge/br.c
@@ -37,7 +37,9 @@ static int __init br_init(void)
 		return -EADDRINUSE;
 	}
 
-	br_fdb_init();
+	err = br_fdb_init();
+	if (err)
+		goto err_out0;
 
 	err = br_netfilter_init();
 	if (err)
@@ -63,7 +65,10 @@ err_out3:
 err_out2:
 	br_netfilter_fini();
 err_out1:
+	br_fdb_fini();
+err_out0:
 	llc_sap_put(br_stp_sap);
+
 	return err;
 }
 
Index: 2.6-mm/net/bridge/br_fdb.c
===================================================================
--- 2.6-mm.orig/net/bridge/br_fdb.c
+++ 2.6-mm/net/bridge/br_fdb.c
@@ -27,12 +27,14 @@ static struct kmem_cache *br_fdb_cache _
 static int fdb_insert(struct net_bridge *br, struct net_bridge_port *source,
 		      const unsigned char *addr);
 
-void __init br_fdb_init(void)
+int __init br_fdb_init(void)
 {
 	br_fdb_cache = kmem_cache_create("bridge_fdb_cache",
 					 sizeof(struct net_bridge_fdb_entry),
 					 0,
 					 SLAB_HWCACHE_ALIGN, NULL, NULL);
+
+	return br_fdb_cache ? 0 : -ENOMEM;
 }
 
 void __exit br_fdb_fini(void)
Index: 2.6-mm/net/bridge/br_private.h
===================================================================
--- 2.6-mm.orig/net/bridge/br_private.h
+++ 2.6-mm/net/bridge/br_private.h
@@ -133,7 +133,7 @@ extern void br_dev_setup(struct net_devi
 extern int br_dev_xmit(struct sk_buff *skb, struct net_device *dev);
 
 /* br_fdb.c */
-extern void br_fdb_init(void);
+extern int br_fdb_init(void);
 extern void br_fdb_fini(void);
 extern void br_fdb_changeaddr(struct net_bridge_port *p,
 			      const unsigned char *newaddr);

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

* Re: [Bridge] [PATCH] bridge: check kmem_cache_create() error
  2007-04-07  9:57 [Bridge] [PATCH] bridge: check kmem_cache_create() error Akinobu Mita
@ 2007-04-09 18:55 ` Stephen Hemminger
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2007-04-09 18:55 UTC (permalink / raw)
  To: Akinobu Mita; +Cc: bridge

On Sat, 7 Apr 2007 18:57:07 +0900
Akinobu Mita <akinobu.mita@gmail.com> wrote:

> This patch checks kmem_cache_create() error and aborts loading module
> on failure.
> 
> Cc: Stephen Hemminger <shemminger@linux-foundation.org>
> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
> 

applied for 2.6.22 update bundle

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

end of thread, other threads:[~2007-04-09 18:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-07  9:57 [Bridge] [PATCH] bridge: check kmem_cache_create() error Akinobu Mita
2007-04-09 18:55 ` Stephen Hemminger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.