Skip to content

Commit 5ccbf63

Browse files
Awik84dledford
authored andcommitted
IB/uverbs: Prevent reregistration of DM_MR to regular MR
This patch adds a check in the ib_uverbs_rereg_mr flow to make sure there's no attempt to rereg a device memory MR to regular MR. In such case the command will fail with -EINVAL status. fixes: be934cc ("IB/uverbs: Add device memory registration ioctl support") Signed-off-by: Ariel Levkovich <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
1 parent 4f9ca2d commit 5ccbf63

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/infiniband/core/uverbs_cmd.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,11 @@ ssize_t ib_uverbs_rereg_mr(struct ib_uverbs_file *file,
765765

766766
mr = uobj->object;
767767

768+
if (mr->dm) {
769+
ret = -EINVAL;
770+
goto put_uobjs;
771+
}
772+
768773
if (cmd.flags & IB_MR_REREG_ACCESS) {
769774
ret = ib_check_mr_access(cmd.access_flags);
770775
if (ret)

0 commit comments

Comments
 (0)