Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=87a596e0b8bc344bd6bfebe83b56d11fb79ee23a
Commit:     87a596e0b8bc344bd6bfebe83b56d11fb79ee23a
Parent:     ffe1d49cc300f3dff990093aa952a2fbb371c1b6
Author:     Akinobu Mita <[EMAIL PROTECTED]>
AuthorDate: Sat Apr 7 18:57:07 2007 +0900
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Wed Apr 25 22:28:51 2007 -0700

    bridge: check kmem_cache_create() error
    
    This patch checks kmem_cache_create() error and aborts loading module
    on failure.
    
    Signed-off-by: Akinobu Mita <[EMAIL PROTECTED]>
    Signed-off-by: Stephen Hemminger <[EMAIL PROTECTED]>
---
 net/bridge/br.c         |    4 +++-
 net/bridge/br_fdb.c     |    6 +++++-
 net/bridge/br_private.h |    2 +-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/net/bridge/br.c b/net/bridge/br.c
index 601c37d..848b8fa 100644
--- a/net/bridge/br.c
+++ b/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_out1;
 
        err = br_netfilter_init();
        if (err)
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index 22645e3..91b0170 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -31,13 +31,17 @@ static int fdb_insert(struct net_bridge *br, struct 
net_bridge_port *source,
 
 static u32 fdb_salt __read_mostly;
 
-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);
+       if (!br_fdb_cache)
+               return -ENOMEM;
+
        get_random_bytes(&fdb_salt, sizeof(fdb_salt));
+       return 0;
 }
 
 void __exit br_fdb_fini(void)
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 974fecc..21bf3a9 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -141,7 +141,7 @@ extern void br_dev_setup(struct net_device *dev);
 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_flush(struct net_bridge *br);
 extern void br_fdb_changeaddr(struct net_bridge_port *p,
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to