Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fuse: fix leaked notify reply

fuse_request_send_notify_reply() may fail if the connection was reset for
some reason (e.g. fs was unmounted). Don't leak request reference in this
case. Besides leaking memory, this resulted in fc->num_waiting not being
decremented and hence fuse_wait_aborted() left in a hanging and unkillable
state.

Fixes: 2d45ba381a74 ("fuse: add retrieve request")
Fixes: b8f95e5d13f5 ("fuse: umount should wait for all requests")
Reported-and-tested-by: syzbot+6339eda9cb4ebbc4c37b@syzkaller.appspotmail.com
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Cc: <stable@vger.kernel.org> #v2.6.36

+3 -1
+3 -1
fs/fuse/dev.c
··· 1768 1768 req->in.args[1].size = total_len; 1769 1769 1770 1770 err = fuse_request_send_notify_reply(fc, req, outarg->notify_unique); 1771 - if (err) 1771 + if (err) { 1772 1772 fuse_retrieve_end(fc, req); 1773 + fuse_put_request(fc, req); 1774 + } 1773 1775 1774 1776 return err; 1775 1777 }