|
@@ -46,6 +46,8 @@
|
|
#include <linux/mutex.h>
|
|
#include <linux/mutex.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/slab.h>
|
|
|
|
|
|
|
|
+#include <linux/nospec.h>
|
|
|
|
+
|
|
#include <linux/uaccess.h>
|
|
#include <linux/uaccess.h>
|
|
|
|
|
|
#include <rdma/ib.h>
|
|
#include <rdma/ib.h>
|
|
@@ -1120,6 +1122,7 @@ static ssize_t ib_ucm_write(struct file *filp, const char __user *buf,
|
|
|
|
|
|
if (hdr.cmd >= ARRAY_SIZE(ucm_cmd_table))
|
|
if (hdr.cmd >= ARRAY_SIZE(ucm_cmd_table))
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
|
|
+ hdr.cmd = array_index_nospec(hdr.cmd, ARRAY_SIZE(ucm_cmd_table));
|
|
|
|
|
|
if (hdr.in + sizeof(hdr) > len)
|
|
if (hdr.in + sizeof(hdr) > len)
|
|
return -EINVAL;
|
|
return -EINVAL;
|