From: Csaba Henk Date: Fri, 27 Nov 2009 14:00:14 +0000 (+0530) Subject: fuse: reject O_DIRECT flag also in fuse_create X-Git-Tag: v2.6.32~41^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1b7323965a8c6eee9dc4e345a7ae4bff1dc93149;p=platform%2Fkernel%2Flinux-3.10.git fuse: reject O_DIRECT flag also in fuse_create The comment in fuse_open about O_DIRECT: "VFS checks this, but only _after_ ->open()" also holds for fuse_create, however, the same kind of check was missing there. As an impact of this bug, open(newfile, O_RDWR|O_CREAT|O_DIRECT) fails, but a stub newfile will remain if the fuse server handled the implied FUSE_CREATE request appropriately. Other impact: in the above situation ima_file_free() will complain to open/free imbalance if CONFIG_IMA is set. Signed-off-by: Csaba Henk Signed-off-by: Miklos Szeredi Cc: Harshavardhana Cc: stable@kernel.org --- diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 8ada78a..4787ae6 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -385,6 +385,9 @@ static int fuse_create_open(struct inode *dir, struct dentry *entry, int mode, if (fc->no_create) return -ENOSYS; + if (flags & O_DIRECT) + return -EINVAL; + forget_req = fuse_get_req(fc); if (IS_ERR(forget_req)) return PTR_ERR(forget_req);