From 9294657fb966c685cf6a99f4bbe73a91eb2b8f3c Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Sun, 23 Oct 2011 10:07:20 +0200 Subject: [PATCH] Reply with ENOMEM in case of failure to allocate request Reply to request with ENOMEM in case of failure to allocate request structure. Otherwise the task issuing the request will just freeze up until the filesystem daemon is killed. Reported by Stephan Kulow --- ChangeLog | 7 +++++++ lib/fuse_lowlevel.c | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/ChangeLog b/ChangeLog index 4be41e3..77a9b9e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-10-13 Miklos Szeredi + + * Reply to request with ENOMEM in case of failure to allocate + request structure. Otherwise the task issuing the request will + just freeze up until the filesystem daemon is killed. Reported by + Stephan Kulow + 2011-09-13 Miklos Szeredi * Released 2.8.6 diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c index c519bfb..c86a910 100644 --- a/lib/fuse_lowlevel.c +++ b/lib/fuse_lowlevel.c @@ -1467,7 +1467,18 @@ static void fuse_ll_process(void *data, const char *buf, size_t len, req = (struct fuse_req *) calloc(1, sizeof(struct fuse_req)); if (req == NULL) { + struct fuse_out_header out = { + .unique = in->unique, + .error = -ENOMEM, + .len = sizeof(struct fuse_out_header), + }; + struct iovec iov = { + .iov_base = &out, + .iov_len = sizeof(struct fuse_out_header), + }; + fprintf(stderr, "fuse: failed to allocate request\n"); + fuse_chan_send(ch, &iov, 1); return; } -- 2.30.2