diff options
author | Parav Pandit <parav@mellanox.com> | 2019-02-26 15:01:46 +0300 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2019-03-28 20:52:02 +0300 |
commit | 41c6140189afdf67bd07d7bbe2d8f9382b6f9ef7 (patch) | |
tree | 5a82ffb0e06801b4e617cd2646f81cf14b1212c4 /drivers/infiniband/core/cma.c | |
parent | a56bc45b27b92954d99c811cb047e789b6cc5a81 (diff) | |
download | linux-41c6140189afdf67bd07d7bbe2d8f9382b6f9ef7.tar.xz |
RDMA: Check net namespace access for uverbs, umad, cma and nldev
Introduce an API rdma_dev_access_netns() to check whether a rdma device
can be accessed from the specified net namespace or not.
Use rdma_dev_access_netns() while opening character uverbs, umad network
device and also check while rdma cm_id binds to rdma device.
Signed-off-by: Parav Pandit <parav@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/infiniband/core/cma.c')
-rw-r--r-- | drivers/infiniband/core/cma.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index a8b9c66c8525..895899230a7e 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c @@ -616,6 +616,9 @@ cma_validate_port(struct ib_device *device, u8 port, int dev_type = dev_addr->dev_type; struct net_device *ndev = NULL; + if (!rdma_dev_access_netns(device, id_priv->id.route.addr.dev_addr.net)) + return ERR_PTR(-ENODEV); + if ((dev_type == ARPHRD_INFINIBAND) && !rdma_protocol_ib(device, port)) return ERR_PTR(-ENODEV); |