|
@@ -53,6 +53,8 @@
|
|
#include <uapi/linux/if_ether.h>
|
|
#include <uapi/linux/if_ether.h>
|
|
#include <net/ipv6.h>
|
|
#include <net/ipv6.h>
|
|
#include <net/ip.h>
|
|
#include <net/ip.h>
|
|
|
|
+#include <linux/string.h>
|
|
|
|
+#include <linux/slab.h>
|
|
|
|
|
|
#include <linux/atomic.h>
|
|
#include <linux/atomic.h>
|
|
#include <linux/mmu_notifier.h>
|
|
#include <linux/mmu_notifier.h>
|
|
@@ -1922,6 +1924,31 @@ static inline int ib_copy_to_udata(struct ib_udata *udata, void *src, size_t len
|
|
return copy_to_user(udata->outbuf, src, len) ? -EFAULT : 0;
|
|
return copy_to_user(udata->outbuf, src, len) ? -EFAULT : 0;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static inline bool ib_is_udata_cleared(struct ib_udata *udata,
|
|
|
|
+ size_t offset,
|
|
|
|
+ size_t len)
|
|
|
|
+{
|
|
|
|
+ const void __user *p = udata->inbuf + offset;
|
|
|
|
+ bool ret = false;
|
|
|
|
+ u8 *buf;
|
|
|
|
+
|
|
|
|
+ if (len > USHRT_MAX)
|
|
|
|
+ return false;
|
|
|
|
+
|
|
|
|
+ buf = kmalloc(len, GFP_KERNEL);
|
|
|
|
+ if (!buf)
|
|
|
|
+ return false;
|
|
|
|
+
|
|
|
|
+ if (copy_from_user(buf, p, len))
|
|
|
|
+ goto free;
|
|
|
|
+
|
|
|
|
+ ret = !memchr_inv(buf, 0, len);
|
|
|
|
+
|
|
|
|
+free:
|
|
|
|
+ kfree(buf);
|
|
|
|
+ return ret;
|
|
|
|
+}
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* ib_modify_qp_is_ok - Check that the supplied attribute mask
|
|
* ib_modify_qp_is_ok - Check that the supplied attribute mask
|
|
* contains all required attributes and no attributes not allowed for
|
|
* contains all required attributes and no attributes not allowed for
|