Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 299551
b: refs/heads/master
c: b922934
h: refs/heads/master
i:
  299549: 6fdf5ef
  299547: bc99b88
  299543: 8b9265c
  299535: a4aa117
  299519: 2f3aa68
v: v3
  • Loading branch information
Julian Anastasov authored and David S. Miller committed Apr 18, 2012
1 parent 44eade0 commit be89144
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9fe5642f4a3b13beb43c2633db7df22dd9d99250
refs/heads/master: b922934d017f1cc831b017913ed7d1a56c558b43
33 changes: 18 additions & 15 deletions trunk/net/core/net_namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,21 +83,29 @@ static int net_assign_generic(struct net *net, int id, void *data)

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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit be89144

Please sign in to comment.