summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCsaba Henk <csaba@gluster.com>2009-11-27 19:30:14 +0530
committerGreg Kroah-Hartman <gregkh@suse.de>2009-12-08 11:17:19 -0800
commite192c2e5db689c874f6e56166face8ac96544350 (patch)
tree17c633277d6c121bdf16c3fd2d3b585edd9e9e2b
parentfdab80d867f4df236d5158a232275147964a7705 (diff)
fuse: reject O_DIRECT flag also in fuse_create
commit 1b7323965a8c6eee9dc4e345a7ae4bff1dc93149 upstream. 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 <csaba@gluster.com> Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Cc: Harshavardhana <harsha@gluster.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--fs/fuse/dir.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index fd03330cadeb..1695c2e708c0 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -398,6 +398,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);