|
@@ -583,9 +583,6 @@ static ssize_t ib_uverbs_write(struct file *filp, const char __user *buf,
|
|
|
if (copy_from_user(&hdr, buf, sizeof hdr))
|
|
|
return -EFAULT;
|
|
|
|
|
|
- if (hdr.in_words * 4 != count)
|
|
|
- return -EINVAL;
|
|
|
-
|
|
|
if (hdr.command >= ARRAY_SIZE(uverbs_cmd_table) ||
|
|
|
!uverbs_cmd_table[hdr.command])
|
|
|
return -EINVAL;
|
|
@@ -597,8 +594,30 @@ static ssize_t ib_uverbs_write(struct file *filp, const char __user *buf,
|
|
|
if (!(file->device->ib_dev->uverbs_cmd_mask & (1ull << hdr.command)))
|
|
|
return -ENOSYS;
|
|
|
|
|
|
- return uverbs_cmd_table[hdr.command](file, buf + sizeof hdr,
|
|
|
- hdr.in_words * 4, hdr.out_words * 4);
|
|
|
+ if (hdr.command >= IB_USER_VERBS_CMD_THRESHOLD) {
|
|
|
+ struct ib_uverbs_cmd_hdr_ex hdr_ex;
|
|
|
+
|
|
|
+ if (copy_from_user(&hdr_ex, buf, sizeof(hdr_ex)))
|
|
|
+ return -EFAULT;
|
|
|
+
|
|
|
+ if (((hdr_ex.in_words + hdr_ex.provider_in_words) * 4) != count)
|
|
|
+ return -EINVAL;
|
|
|
+
|
|
|
+ return uverbs_cmd_table[hdr.command](file,
|
|
|
+ buf + sizeof(hdr_ex),
|
|
|
+ (hdr_ex.in_words +
|
|
|
+ hdr_ex.provider_in_words) * 4,
|
|
|
+ (hdr_ex.out_words +
|
|
|
+ hdr_ex.provider_out_words) * 4);
|
|
|
+ } else {
|
|
|
+ if (hdr.in_words * 4 != count)
|
|
|
+ return -EINVAL;
|
|
|
+
|
|
|
+ return uverbs_cmd_table[hdr.command](file,
|
|
|
+ buf + sizeof(hdr),
|
|
|
+ hdr.in_words * 4,
|
|
|
+ hdr.out_words * 4);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
static int ib_uverbs_mmap(struct file *filp, struct vm_area_struct *vma)
|