Merge tag 'v4.4.18' into linux-linaro-lsk-v4.4
[firefly-linux-kernel-4.4.55.git] / drivers / staging / rdma / ipath / ipath_file_ops.c
index 13c3cd11ab92a5c610ef7a5e32795a0b0a0931c9..05d30f433b19439b335f0d4bfd37a6760373055a 100644 (file)
@@ -45,6 +45,8 @@
 #include <linux/uio.h>
 #include <asm/pgtable.h>
 
+#include <rdma/ib.h>
+
 #include "ipath_kernel.h"
 #include "ipath_common.h"
 #include "ipath_user_sdma.h"
@@ -2243,6 +2245,9 @@ static ssize_t ipath_write(struct file *fp, const char __user *data,
        ssize_t ret = 0;
        void *dest;
 
+       if (WARN_ON_ONCE(!ib_safe_file_access(fp)))
+               return -EACCES;
+
        if (count < sizeof(cmd.type)) {
                ret = -EINVAL;
                goto bail;