[095/141] eCryptfs: Check return of filemap_write_and_wait during fsync

Steven Rostedt
2013-07-03T19:07:46Z

[-- Attachment #1: 0095-eCryptfs-Check-return-of-filemap_write_and_wait-duri.patch --]
[-- Type: text/plain, Size: 1097 bytes --]

3.6.11.6 stable review patch.
If anyone has any objections, please let me know.

------------------

From: Tyler Hicks <tyhicks@canonical.com>

[ Upstream commit bc5abcf7e411b889f73ea2a90439071a0f451011 ]

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>
Cc: stable@vger.kernel.org # v3.6+
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
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 4f9a25e..9d5dd5c 100644
--- a/fs/ecryptfs/file.c
+++ b/fs/ecryptfs/file.c
@@ -296,7 +296,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);
}

--
1.7.10.4