[openib-general] [PATCH] mthca: check for illegal acl when registering an mr
Roland Dreier
rolandd at cisco.com
Mon Oct 3 09:18:08 PDT 2005
Christoph> The check should be in ib_uverbs_reg_mr(), not in every driver.
Agreed -- I did it like this:
--- infiniband/core/uverbs_cmd.c (revision 3613)
+++ infiniband/core/uverbs_cmd.c (working copy)
@@ -396,6 +396,14 @@ ssize_t ib_uverbs_reg_mr(struct ib_uverb
if ((cmd.start & ~PAGE_MASK) != (cmd.hca_va & ~PAGE_MASK))
return -EINVAL;
+ /*
+ * Local write permission is required if remote write or
+ * remote atomic permission is also requested.
+ */
+ if (cmd.access_flags & (IB_ACCESS_REMOTE_ATOMIC | IB_ACCESS_REMOTE_WRITE) &&
+ !(cmd.access_flags & IB_ACCESS_LOCAL_WRITE))
+ return -EINVAL;
+
obj = kmalloc(sizeof *obj, GFP_KERNEL);
if (!obj)
return -ENOMEM;
More information about the general
mailing list