RDMA/cma: Update cma_validate_port to honor net namespace
authorParav Pandit <parav@mellanox.com>
Tue, 9 Jan 2018 13:58:56 +0000 (15:58 +0200)
committerJason Gunthorpe <jgg@mellanox.com>
Mon, 22 Jan 2018 18:39:50 +0000 (11:39 -0700)
cma_validate_port uses rdma_dev_addr to validate the port of the cm_id.
It needs to honor the net namespace which is setup during cm_id creation
when finding netdevice.

Signed-off-by: Parav Pandit <parav@mellanox.com>
Reviewed-by: Mark Bloch <markb@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/core/cma.c

index 575ee46762527ca9e6d7d172a7cc8427cad6bc69..2784512f597f826e8ce117b1b96af21e459a2b50 100644 (file)
@@ -628,7 +628,7 @@ static inline int cma_validate_port(struct ib_device *device, u8 port,
                return ret;
 
        if (dev_type == ARPHRD_ETHER && rdma_protocol_roce(device, port)) {
-               ndev = dev_get_by_index(&init_net, bound_if_index);
+               ndev = dev_get_by_index(dev_addr->net, bound_if_index);
                if (!ndev)
                        return ret;
        } else {