aboutsummaryrefslogtreecommitdiffstats
path: root/lib/fuse_lowlevel.c
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2011-10-23 10:07:20 +0200
committerMiklos Szeredi <mszeredi@suse.cz>2011-10-23 10:07:20 +0200
commit42d5c66b0bd1b465ddd586a8c339b56799694f3f (patch)
tree42236b23e7b994aee821ae0517f0ec4ecfe93eca /lib/fuse_lowlevel.c
parent7728b36a83fe20b366b1b6e72f3d0906ca89840c (diff)
downloadandroid_external_fuse-42d5c66b0bd1b465ddd586a8c339b56799694f3f.tar.gz
android_external_fuse-42d5c66b0bd1b465ddd586a8c339b56799694f3f.tar.bz2
android_external_fuse-42d5c66b0bd1b465ddd586a8c339b56799694f3f.zip
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
Diffstat (limited to 'lib/fuse_lowlevel.c')
-rw-r--r--lib/fuse_lowlevel.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c
index b101523..e778faa 100644
--- a/lib/fuse_lowlevel.c
+++ b/lib/fuse_lowlevel.c
@@ -2273,9 +2273,28 @@ static void fuse_ll_process_buf(void *data, const struct fuse_buf *buf,
in = buf->mem;
}
+ if (f->debug) {
+ fprintf(stderr,
+ "unique: %llu, opcode: %s (%i), nodeid: %lu, insize: %zu, pid: %u\n",
+ (unsigned long long) in->unique,
+ opname((enum fuse_opcode) in->opcode), in->opcode,
+ (unsigned long) in->nodeid, buf->size, in->pid);
+ }
+
req = fuse_ll_alloc_req(f);
- if (req == NULL)
+ if (req == NULL) {
+ struct fuse_out_header out = {
+ .unique = in->unique,
+ .error = -ENOMEM,
+ };
+ struct iovec iov = {
+ .iov_base = &out,
+ .iov_len = sizeof(struct fuse_out_header),
+ };
+
+ fuse_send_msg(f, ch, &iov, 1);
goto clear_pipe;
+ }
req->unique = in->unique;
req->ctx.uid = in->uid;
@@ -2283,14 +2302,6 @@ static void fuse_ll_process_buf(void *data, const struct fuse_buf *buf,
req->ctx.pid = in->pid;
req->ch = ch;
- if (f->debug)
- fprintf(stderr,
- "unique: %llu, opcode: %s (%i), nodeid: %lu, insize: %zu, pid: %u\n",
- (unsigned long long) in->unique,
- opname((enum fuse_opcode) in->opcode), in->opcode,
- (unsigned long) in->nodeid, buf->size, in->pid);
-
-
err = EIO;
if (!f->got_init) {
enum fuse_opcode expected;