summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikolaus Rath <Nikolaus@rath.org>2016-11-16 12:45:51 -0800
committerNikolaus Rath <Nikolaus@rath.org>2016-11-16 12:45:51 -0800
commitc4c4819e853a572246c928feabb08028c41851ec (patch)
tree8ad44542abc5be1461c45201a9daecdd91db3754
parentdddd8196079f8472a7dbb93734cc8e098c9898e7 (diff)
downloadfuse-c4c4819e853a572246c928feabb08028c41851ec.tar.gz
Abort if fs requests capabilities not supported by kernel.
See also issue #114.
-rw-r--r--ChangeLog.rst3
-rw-r--r--lib/fuse_lowlevel.c9
2 files changed, 12 insertions, 0 deletions
diff --git a/ChangeLog.rst b/ChangeLog.rst
index 8afe917..867efef 100644
--- a/ChangeLog.rst
+++ b/ChangeLog.rst
@@ -11,6 +11,9 @@ UNRELEASED CHANGES
fuse_session_loop_mt() now return -errno instead of -1 in case of
failure.
+* The FUSE main loop is now aborted if the file-system requests
+ capabilities that are not supported by the kernel.
+
FUSE 3.0.0-rc2 (2016-11-06)
===========================
diff --git a/lib/fuse_lowlevel.c b/lib/fuse_lowlevel.c
index 9fd9144..77fc014 100644
--- a/lib/fuse_lowlevel.c
+++ b/lib/fuse_lowlevel.c
@@ -1916,6 +1916,15 @@ static void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
if (se->op.init)
se->op.init(se->userdata, &se->conn);
+ if (se->conn.want & (~se->conn.capable)) {
+ fprintf(stderr, "fuse: error: filesystem requested capabilites "
+ "that are not supported by kernel, aborting.\n");
+ fuse_reply_err(req, EPROTO);
+ se->error = -EPROTO;
+ fuse_session_exit(se);
+ return;
+ }
+
unsigned max_read_mo = get_max_read(se->mo);
if (se->conn.max_read != max_read_mo) {
fprintf(stderr, "fuse: error: init() and fuse_session_new() "