Skip to content

Commit

Permalink
fuse: fix leaked aux requests
Browse files Browse the repository at this point in the history
Auxiliary requests chained on req->misc.write.next may be leaked on
truncate.  Free these as well if the parent request was truncated off.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
  • Loading branch information
Miklos Szeredi committed Feb 13, 2019
1 parent 419234d commit e2653bd
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions fs/fuse/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1494,6 +1494,7 @@ static void fuse_send_writepage(struct fuse_conn *fc, struct fuse_req *req,
__releases(fc->lock)
__acquires(fc->lock)
{
struct fuse_req *aux, *next;
struct fuse_inode *fi = get_fuse_inode(req->inode);
struct fuse_write_in *inarg = &req->misc.write.in;
__u64 data_size = req->num_pages * PAGE_SIZE;
Expand All @@ -1520,6 +1521,15 @@ __acquires(fc->lock)
out_free:
fuse_writepage_finish(fc, req);
spin_unlock(&fc->lock);

/* After fuse_writepage_finish() aux request list is private */
for (aux = req->misc.write.next; aux; aux = next) {
next = aux->misc.write.next;
aux->misc.write.next = NULL;
fuse_writepage_free(fc, aux);
fuse_put_request(fc, aux);
}

fuse_writepage_free(fc, req);
fuse_put_request(fc, req);
spin_lock(&fc->lock);
Expand Down

0 comments on commit e2653bd

Please sign in to comment.