Skip to content

Commit

Permalink
fuse: reject O_DIRECT flag also in fuse_create
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Miklos Szeredi <[email protected]>
Cc: Harshavardhana <[email protected]>
Cc: [email protected]
  • Loading branch information
csabahenk authored and Miklos Szeredi committed Nov 27, 2009
1 parent a8a8a66 commit 1b73239
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fs/fuse/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1b73239

Please sign in to comment.