diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2007-04-07 05:57:07 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:28:51 -0400 |
commit | 87a596e0b8bc344bd6bfebe83b56d11fb79ee23a (patch) | |
tree | 4fecaa826829e73976319dea651152fe78fce0ff /net/bridge/br_fdb.c | |
parent | ffe1d49cc300f3dff990093aa952a2fbb371c1b6 (diff) |
bridge: check kmem_cache_create() error
This patch checks kmem_cache_create() error and aborts loading module
on failure.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Diffstat (limited to 'net/bridge/br_fdb.c')
-rw-r--r-- | net/bridge/br_fdb.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c index 22645e3edf23..91b017016d5b 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, | |||
31 | 31 | ||
32 | static u32 fdb_salt __read_mostly; | 32 | static u32 fdb_salt __read_mostly; |
33 | 33 | ||
34 | void __init br_fdb_init(void) | 34 | int __init br_fdb_init(void) |
35 | { | 35 | { |
36 | br_fdb_cache = kmem_cache_create("bridge_fdb_cache", | 36 | br_fdb_cache = kmem_cache_create("bridge_fdb_cache", |
37 | sizeof(struct net_bridge_fdb_entry), | 37 | sizeof(struct net_bridge_fdb_entry), |
38 | 0, | 38 | 0, |
39 | SLAB_HWCACHE_ALIGN, NULL, NULL); | 39 | SLAB_HWCACHE_ALIGN, NULL, NULL); |
40 | if (!br_fdb_cache) | ||
41 | return -ENOMEM; | ||
42 | |||
40 | get_random_bytes(&fdb_salt, sizeof(fdb_salt)); | 43 | get_random_bytes(&fdb_salt, sizeof(fdb_salt)); |
44 | return 0; | ||
41 | } | 45 | } |
42 | 46 | ||
43 | void __exit br_fdb_fini(void) | 47 | void __exit br_fdb_fini(void) |