summaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core
diff options
context:
space:
mode:
authorMatan Barak2018-04-24 10:15:20 +0200
committerDoug Ledford2018-04-27 19:53:41 +0200
commitf604db645a66b7ba4f21c426fe73253928dada41 (patch)
tree1b9af4cbb62fb8627f6673a53c2a8a814ab3a837 /drivers/infiniband/core
parentRDMA/cxgb4: release hw resources on device removal (diff)
downloadkernel-qcow2-linux-f604db645a66b7ba4f21c426fe73253928dada41.tar.gz
kernel-qcow2-linux-f604db645a66b7ba4f21c426fe73253928dada41.tar.xz
kernel-qcow2-linux-f604db645a66b7ba4f21c426fe73253928dada41.zip
IB/uverbs: Fix validating mandatory attributes
Previously, if a method contained mandatory attributes in a namespace that wasn't given by the user, these attributes weren't validated. Fixing this by iterating over all specification namespaces. Fixes: fac9658cabb9 ("IB/core: Add new ioctl interface") Signed-off-by: Matan Barak <matanb@mellanox.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/core')
-rw-r--r--drivers/infiniband/core/uverbs_ioctl.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/infiniband/core/uverbs_ioctl.c b/drivers/infiniband/core/uverbs_ioctl.c
index 8c93970dc8f1..8d32c4ae368c 100644
--- a/drivers/infiniband/core/uverbs_ioctl.c
+++ b/drivers/infiniband/core/uverbs_ioctl.c
@@ -234,6 +234,15 @@ static int uverbs_validate_kernel_mandatory(const struct uverbs_method_spec *met
return -EINVAL;
}
+ for (; i < method_spec->num_buckets; i++) {
+ struct uverbs_attr_spec_hash *attr_spec_bucket =
+ method_spec->attr_buckets[i];
+
+ if (!bitmap_empty(attr_spec_bucket->mandatory_attrs_bitmask,
+ attr_spec_bucket->num_attrs))
+ return -EINVAL;
+ }
+
return 0;
}