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>
This commit is contained in:
Akinobu Mita
2007-04-07 18:57:07 +09:00
committed by David S. Miller
parent ffe1d49cc3
commit 87a596e0b8
3 changed files with 9 additions and 3 deletions

View File

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