Skip to content

Commit f604db6

Browse files
matanb10dledford
authored andcommitted
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: fac9658 ("IB/core: Add new ioctl interface") Signed-off-by: Matan Barak <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
1 parent 26bff1b commit f604db6

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/infiniband/core/uverbs_ioctl.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,15 @@ static int uverbs_validate_kernel_mandatory(const struct uverbs_method_spec *met
234234
return -EINVAL;
235235
}
236236

237+
for (; i < method_spec->num_buckets; i++) {
238+
struct uverbs_attr_spec_hash *attr_spec_bucket =
239+
method_spec->attr_buckets[i];
240+
241+
if (!bitmap_empty(attr_spec_bucket->mandatory_attrs_bitmask,
242+
attr_spec_bucket->num_attrs))
243+
return -EINVAL;
244+
}
245+
237246
return 0;
238247
}
239248

0 commit comments

Comments
 (0)