Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/vapier...
[cascardo/linux.git] / fs / ecryptfs / mmap.c
index 5e15013..6a44148 100644 (file)
@@ -381,6 +381,11 @@ static int ecryptfs_write_begin(struct file *file,
            && (pos != 0))
                zero_user(page, 0, PAGE_CACHE_SIZE);
 out:
+       if (unlikely(rc)) {
+               unlock_page(page);
+               page_cache_release(page);
+               *pagep = NULL;
+       }
        return rc;
 }