aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorRoland Dreier <rolandd@cisco.com>2005-10-03 12:18:02 -0400
committerRoland Dreier <rolandd@cisco.com>2005-10-17 18:20:27 -0400
commitf575394f1de9b4afa4b474f1882c7e2d3b8e51d7 (patch)
treeb9ffc5983cbba3acbb8d7233d26101c38f4d7e61 /drivers/infiniband
parent9825051e8c81cbd4400333e7cdc04be77a0bab75 (diff)
[IB] uverbs: reject invalid memory registration permission flags
Reject userspace memory registrations with invalid permission flags: "local write" is required if "remote write" or "remote atomic" is also requested. Pointed out by Jack Morgenstein <jackm@mellanox.co.il> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/core/uverbs_cmd.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index a0ceb1cbed52..2e959acf2ff1 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -396,6 +396,14 @@ ssize_t ib_uverbs_reg_mr(struct ib_uverbs_file *file,
396 if ((cmd.start & ~PAGE_MASK) != (cmd.hca_va & ~PAGE_MASK)) 396 if ((cmd.start & ~PAGE_MASK) != (cmd.hca_va & ~PAGE_MASK))
397 return -EINVAL; 397 return -EINVAL;
398 398
399 /*
400 * Local write permission is required if remote write or
401 * remote atomic permission is also requested.
402 */
403 if (cmd.access_flags & (IB_ACCESS_REMOTE_ATOMIC | IB_ACCESS_REMOTE_WRITE) &&
404 !(cmd.access_flags & IB_ACCESS_LOCAL_WRITE))
405 return -EINVAL;
406
399 obj = kmalloc(sizeof *obj, GFP_KERNEL); 407 obj = kmalloc(sizeof *obj, GFP_KERNEL);
400 if (!obj) 408 if (!obj)
401 return -ENOMEM; 409 return -ENOMEM;