diff options
author | David Howells <dhowells@redhat.com> | 2018-01-02 13:02:19 +0300 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2018-01-02 13:02:19 +0300 |
commit | afae457d874860a7e299d334f59eede5f3ad4b47 (patch) | |
tree | 37141a6a1d39ba21135561eeeae2fa2cad90bb8b /fs/afs/write.c | |
parent | 440fbc3a8a694467ba641234cedb96c28ab2d5fb (diff) | |
download | linux-afae457d874860a7e299d334f59eede5f3ad4b47.tar.xz |
afs: Fix missing error handling in afs_write_end()
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>
Diffstat (limited to 'fs/afs/write.c')
-rw-r--r-- | fs/afs/write.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/afs/write.c b/fs/afs/write.c index cb5f8a3df577..9370e2feb999 100644 --- a/fs/afs/write.c +++ b/fs/afs/write.c @@ -198,7 +198,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); } @@ -206,10 +206,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; } /* |