Skip to content

Commit afae457

Browse files
committed
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>
1 parent 440fbc3 commit afae457

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

fs/afs/write.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,18 +198,20 @@ int afs_write_end(struct file *file, struct address_space *mapping,
198198
ret = afs_fill_page(vnode, key, pos + copied,
199199
len - copied, page);
200200
if (ret < 0)
201-
return ret;
201+
goto out;
202202
}
203203
SetPageUptodate(page);
204204
}
205205

206206
set_page_dirty(page);
207207
if (PageDirty(page))
208208
_debug("dirtied");
209+
ret = copied;
210+
211+
out:
209212
unlock_page(page);
210213
put_page(page);
211-
212-
return copied;
214+
return ret;
213215
}
214216

215217
/*

0 commit comments

Comments
 (0)