If error happened during new net-namespace creation we might
end up having VE reference taken and never put back.

 | copy_net_ns
 |  setup_net
 |   ...
 |   net->owner_ve = get_ve(get_exec_env());
 |   ...
 |   error = ops_init(ops, net);
 |   if (error < 0)
 |    goto out_undo;
 |   ...
 |   return error;
 |  put_user_ns(user_ns);
 |  net_drop_ns(net);
 |   net_free(ns);
 |    kfree(net->gen);
 |    kmem_cache_free(net_cachep, net);

So lets call for put_ve to balance.

Signed-off-by: Cyrill Gorcunov <gorcu...@odin.com>
CC: Vladimir Davydov <vdavy...@odin.com>
CC: Konstantin Khorenko <khore...@odin.com>
CC: Andrey Vagin <ava...@odin.com>
---
 net/core/net_namespace.c |    3 +++
 1 file changed, 3 insertions(+)

Index: linux-pcs7.git/net/core/net_namespace.c
===================================================================
--- linux-pcs7.git.orig/net/core/net_namespace.c
+++ linux-pcs7.git/net/core/net_namespace.c
@@ -192,6 +192,9 @@ out_undo:
                ops_free_list(ops, &net_exit_list);
 
        rcu_barrier();
+#ifdef CONFIG_VE
+       put_ve(net->owner_ve);
+#endif
        goto out;
 }
 
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to