From: Akinobu Mita <akinobu.mita@gmail.com>
To: Stephen Hemminger <shemminger@linux-foundation.org>
Cc: bridge@lists.osdl.org
Subject: [Bridge] [PATCH] bridge: check kmem_cache_create() error
Date: Sat, 7 Apr 2007 18:57:07 +0900 [thread overview]
Message-ID: <20070407095707.GC4660@APFDCB5C> (raw)
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);
next reply other threads:[~2007-04-07 9:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-07 9:57 Akinobu Mita [this message]
2007-04-09 18:55 ` [Bridge] [PATCH] bridge: check kmem_cache_create() error Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070407095707.GC4660@APFDCB5C \
--to=akinobu.mita@gmail.com \
--cc=bridge@lists.osdl.org \
--cc=shemminger@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox