summaryrefslogtreecommitdiff
path: root/fs/afs/write.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2018-01-02 13:02:19 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-03-03 12:24:32 +0300
commit622ded58410c69c821bd5e4b9b5be2dbc0af2c01 (patch)
tree9231cd0be8453e3af4f75d696cd05f03212dac60 /fs/afs/write.c
parent4ebaea9e65d20714120d92bc687bbf57f2f64a94 (diff)
downloadlinux-622ded58410c69c821bd5e4b9b5be2dbc0af2c01.tar.xz
afs: Fix missing error handling in afs_write_end()
[ Upstream commit afae457d874860a7e299d334f59eede5f3ad4b47 ] afs_write_end() is missing page unlock and put if afs_fill_page() fails. Reported-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/afs/write.c')
-rw-r--r--fs/afs/write.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/afs/write.c b/fs/afs/write.c
index 106e43db1115..926d4d68f791 100644
--- a/fs/afs/write.c
+++ b/fs/afs/write.c
@@ -282,7 +282,7 @@ int afs_write_end(struct file *file, struct address_space *mapping,
ret = afs_fill_page(vnode, key, pos + copied,
len - copied, page);
if (ret < 0)
- return ret;
+ goto out;
}
SetPageUptodate(page);
}
@@ -290,10 +290,12 @@ int afs_write_end(struct file *file, struct address_space *mapping,
set_page_dirty(page);
if (PageDirty(page))
_debug("dirtied");
+ ret = copied;
+
+out:
unlock_page(page);
put_page(page);
-
- return copied;
+ return ret;
}
/*