author: Eric Biggers <ebiggers3@gmail.com> 2015-09-17 16:01:54 -0700
committer: Linus Torvalds <torvalds@linux-foundation.org> 2015-09-17 21:16:07 -0700
commit: c03e946fdd653c4a23e242aca83da7e9838f5b00
parent: 62bef58a55dfa8ada2a22b2496c6340468ecd98a
Commit Summary:
Diffstat:
1 file changed, 3 insertions, 1 deletion
diff --git a/fs/userfaultfd.c b/fs/userfaultfd.c
index 634e676072cb..f9aeb40a7197 100644
--- a/fs/userfaultfd.c
+++ b/fs/userfaultfd.c
@@ -1287,8 +1287,10 @@ static struct file *userfaultfd_file_create(int flags)
file = anon_inode_getfile("[userfaultfd]", &userfaultfd_fops, ctx,
O_RDWR | (flags & UFFD_SHARED_FCNTL_FLAGS));
- if (IS_ERR(file))
+ if (IS_ERR(file)) {
+ mmput(ctx->mm);
kmem_cache_free(userfaultfd_ctx_cachep, ctx);
+ }
out:
return file;
}