Abort if fs requests capabilities not supported by kernel.
authorNikolaus Rath <Nikolaus@rath.org>
Wed, 16 Nov 2016 20:45:51 +0000 (12:45 -0800)
committerNikolaus Rath <Nikolaus@rath.org>
Wed, 16 Nov 2016 20:45:51 +0000 (12:45 -0800)
See also issue #114.

ChangeLog.rst
lib/fuse_lowlevel.c

index 8afe917569ce7913a114602ef83eab2b827c42c8..867efefd968d6c53c37fe0ea88e800fa77654bcf 100644 (file)
@@ -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)
 ===========================
 
index 9fd914429c9b950e53e6069aa581523261aa9918..77fc014cba52525d2dd603e6e67c32de803e4bdf 100644 (file)
@@ -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() "