[Devel] [PATCH RHEL7 COMMIT] ve/net_ns: Don't forget to put_ve on error path

Konstantin Khorenko khorenko at odin.com
Tue May 19 07:05:20 PDT 2015


The commit is pushed to "branch-rh7-3.10.0-123.1.2-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-123.1.2.vz7.5.3
------>
commit 5cc0f550217a9ce046a45bb4243fbb84ef8113df
Author: Cyrill Gorcunov <gorcunov at odin.com>
Date:   Tue May 19 18:05:19 2015 +0400

    ve/net_ns: Don't forget to put_ve on error path
    
    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 <gorcunov at odin.com>
    
    CC: Vladimir Davydov <vdavydov at odin.com>
    CC: Konstantin Khorenko <khorenko at odin.com>
    CC: Andrey Vagin <avagin at odin.com>
---
 net/core/net_namespace.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 3886803..7a7a989 100644
--- a/net/core/net_namespace.c
+++ b/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;
 }
 



More information about the Devel mailing list