Reply with ENOMEM in case of failure to allocate request
authorMiklos Szeredi <mszeredi@suse.cz>
Sun, 23 Oct 2011 08:07:20 +0000 (10:07 +0200)
committerMiklos Szeredi <mszeredi@suse.cz>
Wed, 2 Nov 2011 17:34:50 +0000 (18:34 +0100)
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
lib/fuse_lowlevel.c

index 4be41e333c69bcee4e9f55191a392c22ce6985c2..77a9b9ef7e21286f818771618bd14e64f6ade3a3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-10-13  Miklos Szeredi <miklos@szeredi.hu>
+
+       * 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 <miklos@szeredi.hu>
 
        * Released 2.8.6
index c519bfbbb73bc2aa8335792247775b6a148eb281..c86a9101c8829610232ecf5416643ba963f0699e 100644 (file)
@@ -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;
        }