Commit 622ded58 authored by David Howells's avatar David Howells Committed by Greg Kroah-Hartman

afs: Fix missing error handling in afs_write_end()


[ Upstream commit afae457d ]

afs_write_end() is missing page unlock and put if afs_fill_page() fails.
Reported-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 4ebaea9e
...@@ -282,7 +282,7 @@ int afs_write_end(struct file *file, struct address_space *mapping, ...@@ -282,7 +282,7 @@ int afs_write_end(struct file *file, struct address_space *mapping,
ret = afs_fill_page(vnode, key, pos + copied, ret = afs_fill_page(vnode, key, pos + copied,
len - copied, page); len - copied, page);
if (ret < 0) if (ret < 0)
return ret; goto out;
} }
SetPageUptodate(page); SetPageUptodate(page);
} }
...@@ -290,10 +290,12 @@ int afs_write_end(struct file *file, struct address_space *mapping, ...@@ -290,10 +290,12 @@ int afs_write_end(struct file *file, struct address_space *mapping,
set_page_dirty(page); set_page_dirty(page);
if (PageDirty(page)) if (PageDirty(page))
_debug("dirtied"); _debug("dirtied");
ret = copied;
out:
unlock_page(page); unlock_page(page);
put_page(page); put_page(page);
return ret;
return copied;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment