From 4dbfc6cccf119acb59d9cf8853a78890c81e21c5 Mon Sep 17 00:00:00 2001 From: Tyler Hicks Date: Tue, 4 Jun 2013 10:24:56 -0700 Subject: [PATCH] eCryptfs: Check return of filemap_write_and_wait during fsync commit bc5abcf7e411b889f73ea2a90439071a0f451011 upstream. Error out of ecryptfs_fsync() if filemap_write_and_wait() fails. Signed-off-by: Tyler Hicks Cc: Paul Taysom Cc: Olof Johansson Signed-off-by: Greg Kroah-Hartman --- fs/ecryptfs/file.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c index a19022fe130f0..3d7fb593f08e6 100644 --- a/fs/ecryptfs/file.c +++ b/fs/ecryptfs/file.c @@ -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); } -- 2.47.2