summaryrefslogtreecommitdiff
path: root/net/core/net_namespace.c
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2012-05-09 02:31:01 -0700
committerOlof Johansson <olof@lixom.net>2012-05-09 02:31:01 -0700
commitd5a2a1ba838f60d92bf67c5eef533e95453752cb (patch)
treef6436b5e2b430197f37e49ffff23e91ef694b303 /net/core/net_namespace.c
parente1851240a891a305946814587497f121b900b4be (diff)
parentd48b97b403d23f6df0b990cee652bdf9a52337a3 (diff)
downloadlinux-3.10-d5a2a1ba838f60d92bf67c5eef533e95453752cb.tar.gz
linux-3.10-d5a2a1ba838f60d92bf67c5eef533e95453752cb.tar.bz2
linux-3.10-d5a2a1ba838f60d92bf67c5eef533e95453752cb.zip
Merge tag 'v3.4-rc6' into next/cleanup
Linux 3.4-rc6 Resolve conflict where an u5500 file had a bugfix go in, but was deleted in the branch staged for next merge window. Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'net/core/net_namespace.c')
-rw-r--r--net/core/net_namespace.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 0e950fda9a0..31a5ae51a45 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -83,21 +83,29 @@ assign:
static int ops_init(const struct pernet_operations *ops, struct net *net)
{
- int err;
+ int err = -ENOMEM;
+ void *data = NULL;
+
if (ops->id && ops->size) {
- void *data = kzalloc(ops->size, GFP_KERNEL);
+ data = kzalloc(ops->size, GFP_KERNEL);
if (!data)
- return -ENOMEM;
+ goto out;
err = net_assign_generic(net, *ops->id, data);
- if (err) {
- kfree(data);
- return err;
- }
+ if (err)
+ goto cleanup;
}
+ err = 0;
if (ops->init)
- return ops->init(net);
- return 0;
+ err = ops->init(net);
+ if (!err)
+ return 0;
+
+cleanup:
+ kfree(data);
+
+out:
+ return err;
}
static void ops_free(const struct pernet_operations *ops, struct net *net)
@@ -448,12 +456,7 @@ static void __unregister_pernet_operations(struct pernet_operations *ops)
static int __register_pernet_operations(struct list_head *list,
struct pernet_operations *ops)
{
- int err = 0;
- err = ops_init(ops, &init_net);
- if (err)
- ops_free(ops, &init_net);
- return err;
-
+ return ops_init(ops, &init_net);
}
static void __unregister_pernet_operations(struct pernet_operations *ops)