diff options
author | Eli Cohen <eli@mellanox.com> | 2016-02-14 10:07:49 -0500 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2016-03-03 10:19:40 -0500 |
commit | eaebc7d21e102d86b389c77686c7e6258dd6d479 (patch) | |
tree | c5b3d1826dd1fe5def9698db5c5fe33441b0420a | |
parent | 2dbd5186a39c7ef0d92045c43b4857c23cb117ab (diff) |
IB/core: Modify conditional on ucontext existence
Since we allow to call legacy verbs using their extended counterpart,
the check on ucontext has to move up to a common area in case this verb
is ever extended.
Signed-off-by: Eli Cohen <eli@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
-rw-r--r-- | drivers/infiniband/core/uverbs_main.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c index 20f0049db5e5..8b299df0ee7b 100644 --- a/drivers/infiniband/core/uverbs_main.c +++ b/drivers/infiniband/core/uverbs_main.c | |||
@@ -735,6 +735,12 @@ static ssize_t ib_uverbs_write(struct file *filp, const char __user *buf, | |||
735 | goto out; | 735 | goto out; |
736 | } | 736 | } |
737 | 737 | ||
738 | if (!file->ucontext && | ||
739 | command != IB_USER_VERBS_CMD_GET_CONTEXT) { | ||
740 | ret = -EINVAL; | ||
741 | goto out; | ||
742 | } | ||
743 | |||
738 | flags = (hdr.command & | 744 | flags = (hdr.command & |
739 | IB_USER_VERBS_CMD_FLAGS_MASK) >> IB_USER_VERBS_CMD_FLAGS_SHIFT; | 745 | IB_USER_VERBS_CMD_FLAGS_MASK) >> IB_USER_VERBS_CMD_FLAGS_SHIFT; |
740 | 746 | ||
@@ -745,12 +751,6 @@ static ssize_t ib_uverbs_write(struct file *filp, const char __user *buf, | |||
745 | goto out; | 751 | goto out; |
746 | } | 752 | } |
747 | 753 | ||
748 | if (!file->ucontext && | ||
749 | command != IB_USER_VERBS_CMD_GET_CONTEXT) { | ||
750 | ret = -EINVAL; | ||
751 | goto out; | ||
752 | } | ||
753 | |||
754 | if (hdr.in_words * 4 != count) { | 754 | if (hdr.in_words * 4 != count) { |
755 | ret = -EINVAL; | 755 | ret = -EINVAL; |
756 | goto out; | 756 | goto out; |