diff options
| author | Andrea Arcangeli <[email protected]> | 2017-02-22 15:42:15 -0800 |
|---|---|---|
| committer | Linus Torvalds <[email protected]> | 2017-02-22 16:41:28 -0800 |
| commit | a94720bf821dd63e72176da5f423ba7935dde67d (patch) | |
| tree | cf518943eefeb9ce2ae619930897c4ef9fb4fae4 | |
| parent | 8474901a33d8a27958bfa99e78736863abd67874 (diff) | |
userfaultfd: use vma_is_anonymous
Cleanup the vma->vm_ops usage.
Side note: it would be more robust if vma_is_anonymous() would also
check that vm_flags hasn't VM_PFNMAP set.
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Andrea Arcangeli <[email protected]>
Cc: "Dr. David Alan Gilbert" <[email protected]>
Cc: Hillf Danton <[email protected]>
Cc: Michael Rapoport <[email protected]>
Cc: Mike Kravetz <[email protected]>
Cc: Mike Rapoport <[email protected]>
Cc: Pavel Emelyanov <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
| -rw-r--r-- | fs/userfaultfd.c | 8 | ||||
| -rw-r--r-- | mm/userfaultfd.c | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c index 71e917387ec3..7e8f0d60718d 100644 --- a/fs/userfaultfd.c +++ b/fs/userfaultfd.c @@ -830,7 +830,7 @@ static int userfaultfd_register(struct userfaultfd_ctx *ctx, /* check not compatible vmas */ ret = -EINVAL; - if (cur->vm_ops) + if (!vma_is_anonymous(cur)) goto out_unlock; /* @@ -855,7 +855,7 @@ static int userfaultfd_register(struct userfaultfd_ctx *ctx, do { cond_resched(); - BUG_ON(vma->vm_ops); + BUG_ON(!vma_is_anonymous(vma)); BUG_ON(vma->vm_userfaultfd_ctx.ctx && vma->vm_userfaultfd_ctx.ctx != ctx); @@ -981,7 +981,7 @@ static int userfaultfd_unregister(struct userfaultfd_ctx *ctx, * provides for more strict behavior to notice * unregistration errors. */ - if (cur->vm_ops) + if (!vma_is_anonymous(cur)) goto out_unlock; found = true; @@ -995,7 +995,7 @@ static int userfaultfd_unregister(struct userfaultfd_ctx *ctx, do { cond_resched(); - BUG_ON(vma->vm_ops); + BUG_ON(!vma_is_anonymous(vma)); /* * Nothing to do: this vma is already registered into this diff --git a/mm/userfaultfd.c b/mm/userfaultfd.c index af817e5060fb..9c2ed70ac78d 100644 --- a/mm/userfaultfd.c +++ b/mm/userfaultfd.c @@ -197,7 +197,7 @@ retry: * FIXME: only allow copying on anonymous vmas, tmpfs should * be added. */ - if (dst_vma->vm_ops) + if (!vma_is_anonymous(dst_vma)) goto out_unlock; /* |