diff options
author | Moni Shoua <monis@mellanox.co.il> | 2011-07-12 13:23:15 +0200 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2011-07-19 01:50:25 +0200 |
commit | 2efdd6a038b2d72e74deb8d4725db1663135268c (patch) | |
tree | 9c03373f1cca98e6538f57c7da8984fba57d99ca /drivers/infiniband | |
parent | RDMA/cma: Avoid assigning an IS_ERR value to cm_id pointer in CMA id object (diff) | |
download | linux-2efdd6a038b2d72e74deb8d4725db1663135268c.tar.xz linux-2efdd6a038b2d72e74deb8d4725db1663135268c.zip |
RDMA/cma: Don't allow IPoIB port space for IBoE
This patch fixes a kernel crash in cma_set_qkey().
When the link layer is Ethernet, it is wrong to use IPoIB port space
since no IPoIB interface is available. Specifically, setting the
Q_Key when port space is RDMA_PS_IPOIB requires MGID calculation and
an SA query, which doesn't make sense over Ethernet.
Signed-off-by: Moni Shoua <monis@mellanox.co.il>
Acked-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/core/cma.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index b60ce2226965..ca4c5dcd7133 100644 --- a/drivers/infiniband/core/cma.c +++ b/drivers/infiniband/core/cma.c @@ -359,6 +359,10 @@ static int cma_acquire_dev(struct rdma_id_private *id_priv) enum rdma_link_layer dev_ll = dev_addr->dev_type == ARPHRD_INFINIBAND ? IB_LINK_LAYER_INFINIBAND : IB_LINK_LAYER_ETHERNET; + if (dev_ll != IB_LINK_LAYER_INFINIBAND && + id_priv->id.ps == RDMA_PS_IPOIB) + return -EINVAL; + mutex_lock(&lock); iboe_addr_get_sgid(dev_addr, &iboe_gid); memcpy(&gid, dev_addr->src_dev_addr + |