X-Git-Url: http://git.cascardo.eti.br/?a=blobdiff_plain;f=fs%2Fopen.c;h=d3ed8171e8e09291b44524e6de943bc3e71c91e3;hb=247f139cdae73b4f47bd348d05dff1afd40b84b6;hp=8aeb08bb278bd92978a823ec63a2c9593bfe7460;hpb=6b5e09a748ad0a0b198d0e268c7e689044bfe48a;p=cascardo%2Flinux.git diff --git a/fs/open.c b/fs/open.c index 8aeb08bb278b..d3ed8171e8e0 100644 --- a/fs/open.c +++ b/fs/open.c @@ -267,6 +267,11 @@ int vfs_fallocate(struct file *file, int mode, loff_t offset, loff_t len) (mode & ~FALLOC_FL_INSERT_RANGE)) return -EINVAL; + /* Unshare range should only be used with allocate mode. */ + if ((mode & FALLOC_FL_UNSHARE_RANGE) && + (mode & ~(FALLOC_FL_UNSHARE_RANGE | FALLOC_FL_KEEP_SIZE))) + return -EINVAL; + if (!(file->f_mode & FMODE_WRITE)) return -EBADF; @@ -300,7 +305,8 @@ int vfs_fallocate(struct file *file, int mode, loff_t offset, loff_t len) * Let individual file system decide if it supports preallocation * for directories or not. */ - if (!S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode)) + if (!S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode) && + !S_ISBLK(inode->i_mode)) return -ENODEV; /* Check for wrap through zero too */