summaryrefslogtreecommitdiff
path: root/drivers/infiniband/core
diff options
context:
space:
mode:
authorJason Gunthorpe <jgg@nvidia.com>2020-10-03 20:20:06 -0300
committerJason Gunthorpe <jgg@nvidia.com>2020-10-26 19:27:58 -0300
commit26e990badde40b2fb824bfa3cb9d4288a79584bc (patch)
tree355d49a7b78e7c655941ae63844f56ac5e270d93 /drivers/infiniband/core
parent652caba5b5501258a46d4b9279e0dbb6e5d42d75 (diff)
downloadlwn-26e990badde40b2fb824bfa3cb9d4288a79584bc.tar.gz
lwn-26e990badde40b2fb824bfa3cb9d4288a79584bc.zip
RDMA: Check attr_mask during modify_qp
Each driver should check that it can support the provided attr_mask during modify_qp. IB_USER_VERBS_EX_CMD_MODIFY_QP was being used to block modify_qp_ex because the driver didn't check RATE_LIMIT. Link: https://lore.kernel.org/r/6-v1-caa70ba3d1ab+1436e-ucmd_mask_jgg@nvidia.com Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'drivers/infiniband/core')
-rw-r--r--drivers/infiniband/core/device.c1
-rw-r--r--drivers/infiniband/core/uverbs_cmd.c8
2 files changed, 3 insertions, 6 deletions
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index efcadbda4409..6d2603571771 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -639,6 +639,7 @@ struct ib_device *_ib_alloc_device(size_t size)
BIT_ULL(IB_USER_VERBS_EX_CMD_DESTROY_RWQ_IND_TBL) |
BIT_ULL(IB_USER_VERBS_EX_CMD_DESTROY_WQ) |
BIT_ULL(IB_USER_VERBS_EX_CMD_MODIFY_CQ) |
+ BIT_ULL(IB_USER_VERBS_EX_CMD_MODIFY_QP) |
BIT_ULL(IB_USER_VERBS_EX_CMD_MODIFY_WQ) |
BIT_ULL(IB_USER_VERBS_EX_CMD_QUERY_DEVICE);
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index f85a61175772..54c3eb463da8 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -1906,8 +1906,7 @@ static int ib_uverbs_modify_qp(struct uverbs_attr_bundle *attrs)
if (ret)
return ret;
- if (cmd.base.attr_mask &
- ~((IB_USER_LEGACY_LAST_QP_ATTR_MASK << 1) - 1))
+ if (cmd.base.attr_mask & ~IB_QP_ATTR_STANDARD_BITS)
return -EOPNOTSUPP;
return modify_qp(attrs, &cmd);
@@ -1929,10 +1928,7 @@ static int ib_uverbs_ex_modify_qp(struct uverbs_attr_bundle *attrs)
* Last bit is reserved for extending the attr_mask by
* using another field.
*/
- BUILD_BUG_ON(IB_USER_LAST_QP_ATTR_MASK == (1ULL << 31));
-
- if (cmd.base.attr_mask &
- ~((IB_USER_LAST_QP_ATTR_MASK << 1) - 1))
+ if (cmd.base.attr_mask & ~(IB_QP_ATTR_STANDARD_BITS | IB_QP_RATE_LIMIT))
return -EOPNOTSUPP;
ret = modify_qp(attrs, &cmd);