Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Eli Cohen and committed by
Doug Ledford
eaebc7d2 2dbd5186

+6 -6
+6 -6
drivers/infiniband/core/uverbs_main.c
··· 735 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 744 flags = (hdr.command & 739 745 IB_USER_VERBS_CMD_FLAGS_MASK) >> IB_USER_VERBS_CMD_FLAGS_SHIFT; 740 746 741 747 if (!flags) { 742 748 if (command >= ARRAY_SIZE(uverbs_cmd_table) || 743 749 !uverbs_cmd_table[command]) { 744 - ret = -EINVAL; 745 - goto out; 746 - } 747 - 748 - if (!file->ucontext && 749 - command != IB_USER_VERBS_CMD_GET_CONTEXT) { 750 750 ret = -EINVAL; 751 751 goto out; 752 752 }