]> git.hungrycats.org Git - linux/commitdiff
eCryptfs: Check return of filemap_write_and_wait during fsync
authorTyler Hicks <tyhicks@canonical.com>
Tue, 4 Jun 2013 17:24:56 +0000 (10:24 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Jun 2013 17:49:32 +0000 (10:49 -0700)
commit bc5abcf7e411b889f73ea2a90439071a0f451011 upstream.

Error out of ecryptfs_fsync() if filemap_write_and_wait() fails.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Cc: Paul Taysom <taysom@chromium.org>
Cc: Olof Johansson <olofj@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ecryptfs/file.c

index a19022fe130f02a13f603346803ce383bd4246b3..3d7fb593f08e6c3cf7b7041347a92f06dcbb823d 100644 (file)
@@ -294,7 +294,12 @@ static int ecryptfs_release(struct inode *inode, struct file *file)
 static int
 ecryptfs_fsync(struct file *file, loff_t start, loff_t end, int datasync)
 {
-       filemap_write_and_wait(file->f_mapping);
+       int rc;
+
+       rc = filemap_write_and_wait(file->f_mapping);
+       if (rc)
+               return rc;
+
        return vfs_fsync(ecryptfs_file_to_lower(file), datasync);
 }