IB/ucma: Take the network namespace from the process
authorGuy Shapiro <guysh@mellanox.com>
Thu, 22 Oct 2015 12:20:11 +0000 (15:20 +0300)
committerDoug Ledford <dledford@redhat.com>
Wed, 28 Oct 2015 16:32:48 +0000 (12:32 -0400)
Add support for network namespaces from user space. This is done by passing
the network namespace of the process instead of init_net.

Signed-off-by: Haggai Eran <haggaie@mellanox.com>
Signed-off-by: Yotam Kenneth <yotamke@mellanox.com>
Signed-off-by: Shachar Raindel <raindel@mellanox.com>
Signed-off-by: Guy Shapiro <guysh@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/core/ucma.c

index e80c107450ab11fb5a32f7ef87629a58f29e5270..8b5a934e1133d80b42e12d1790b3672d73e4a779 100644 (file)
@@ -42,6 +42,7 @@
 #include <linux/slab.h>
 #include <linux/sysctl.h>
 #include <linux/module.h>
+#include <linux/nsproxy.h>
 
 #include <rdma/rdma_user_cm.h>
 #include <rdma/ib_marshall.h>
@@ -472,8 +473,8 @@ static ssize_t ucma_create_id(struct ucma_file *file, const char __user *inbuf,
                return -ENOMEM;
 
        ctx->uid = cmd.uid;
-       ctx->cm_id = rdma_create_id(&init_net, ucma_event_handler, ctx, cmd.ps,
-                                   qp_type);
+       ctx->cm_id = rdma_create_id(current->nsproxy->net_ns,
+                                   ucma_event_handler, ctx, cmd.ps, qp_type);
        if (IS_ERR(ctx->cm_id)) {
                ret = PTR_ERR(ctx->cm_id);
                goto err1;