Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma
[linux-block.git] / drivers / infiniband / hw / hfi1 / file_ops.c
index 06c71b6d8a383dbf6e24fa10a09bfbe129b4f4cc..b1d6ca7e970830aef6eedee06f069ad8f5a0984b 100644 (file)
@@ -424,7 +424,7 @@ static int hfi1_file_mmap(struct file *fp, struct vm_area_struct *vma)
                        ret = -EPERM;
                        goto done;
                }
-               vma->vm_flags &= ~VM_MAYWRITE;
+               vm_flags_clear(vma, VM_MAYWRITE);
                /*
                 * Mmap multiple separate allocations into a single vma.  From
                 * here, dma_mmap_coherent() calls dma_direct_mmap(), which
@@ -560,7 +560,7 @@ static int hfi1_file_mmap(struct file *fp, struct vm_area_struct *vma)
                goto done;
        }
 
-       vma->vm_flags = flags;
+       vm_flags_reset(vma, flags);
        mmap_cdbg(ctxt, subctxt, type, mapio, vmf, memaddr, memvirt, memdma, 
                  memlen, vma);
        if (vmf) {
@@ -1351,12 +1351,15 @@ static int user_exp_rcv_setup(struct hfi1_filedata *fd, unsigned long arg,
                addr = arg + offsetof(struct hfi1_tid_info, tidcnt);
                if (copy_to_user((void __user *)addr, &tinfo.tidcnt,
                                 sizeof(tinfo.tidcnt)))
-                       return -EFAULT;
+                       ret = -EFAULT;
 
                addr = arg + offsetof(struct hfi1_tid_info, length);
-               if (copy_to_user((void __user *)addr, &tinfo.length,
+               if (!ret && copy_to_user((void __user *)addr, &tinfo.length,
                                 sizeof(tinfo.length)))
                        ret = -EFAULT;
+
+               if (ret)
+                       hfi1_user_exp_rcv_invalid(fd, &tinfo);
        }
 
        return ret;