From b4bc9c8560f16775e0cd9db917d787b364efcf9b Mon Sep 17 00:00:00 2001 From: Jan Kara Date: Wed, 14 Nov 2007 16:58:56 -0800 Subject: [PATCH] --- yaml --- r: 73676 b: refs/heads/master c: e47776a0a41a14a5634633c96e590827f552c4b5 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/ext2/ioctl.c | 5 +++++ trunk/fs/ext3/ioctl.c | 5 +++++ trunk/fs/ext4/ioctl.c | 5 +++++ trunk/fs/jfs/ioctl.c | 3 +++ trunk/fs/reiserfs/ioctl.c | 3 +++ 6 files changed, 22 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index aec73275ffe6..58307313260b 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 28822f22e18fc3c422f64b5bf0bb1e6c306af634 +refs/heads/master: e47776a0a41a14a5634633c96e590827f552c4b5 diff --git a/trunk/fs/ext2/ioctl.c b/trunk/fs/ext2/ioctl.c index c2324d5fe4ac..320b2cb3d4d2 100644 --- a/trunk/fs/ext2/ioctl.c +++ b/trunk/fs/ext2/ioctl.c @@ -47,6 +47,11 @@ int ext2_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, flags &= ~EXT2_DIRSYNC_FL; mutex_lock(&inode->i_mutex); + /* Is it quota file? Do not allow user to mess with it */ + if (IS_NOQUOTA(inode)) { + mutex_unlock(&inode->i_mutex); + return -EPERM; + } oldflags = ei->i_flags; /* diff --git a/trunk/fs/ext3/ioctl.c b/trunk/fs/ext3/ioctl.c index 4a2a02c95bf9..023a070f55f1 100644 --- a/trunk/fs/ext3/ioctl.c +++ b/trunk/fs/ext3/ioctl.c @@ -51,6 +51,11 @@ int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, flags &= ~EXT3_DIRSYNC_FL; mutex_lock(&inode->i_mutex); + /* Is it quota file? Do not allow user to mess with it */ + if (IS_NOQUOTA(inode)) { + mutex_unlock(&inode->i_mutex); + return -EPERM; + } oldflags = ei->i_flags; /* The JOURNAL_DATA flag is modifiable only by root */ diff --git a/trunk/fs/ext4/ioctl.c b/trunk/fs/ext4/ioctl.c index c04c7ccba9e3..e7f894bdb420 100644 --- a/trunk/fs/ext4/ioctl.c +++ b/trunk/fs/ext4/ioctl.c @@ -51,6 +51,11 @@ int ext4_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, flags &= ~EXT4_DIRSYNC_FL; mutex_lock(&inode->i_mutex); + /* Is it quota file? Do not allow user to mess with it */ + if (IS_NOQUOTA(inode)) { + mutex_unlock(&inode->i_mutex); + return -EPERM; + } oldflags = ei->i_flags; /* The JOURNAL_DATA flag is modifiable only by root */ diff --git a/trunk/fs/jfs/ioctl.c b/trunk/fs/jfs/ioctl.c index 3c8663bea98c..dfda12a073e1 100644 --- a/trunk/fs/jfs/ioctl.c +++ b/trunk/fs/jfs/ioctl.c @@ -79,6 +79,9 @@ int jfs_ioctl(struct inode * inode, struct file * filp, unsigned int cmd, if (!S_ISDIR(inode->i_mode)) flags &= ~JFS_DIRSYNC_FL; + /* Is it quota file? Do not allow user to mess with it */ + if (IS_NOQUOTA(inode)) + return -EPERM; jfs_get_inode_flags(jfs_inode); oldflags = jfs_inode->mode2; diff --git a/trunk/fs/reiserfs/ioctl.c b/trunk/fs/reiserfs/ioctl.c index c438a8f83f26..e0f0f098a523 100644 --- a/trunk/fs/reiserfs/ioctl.c +++ b/trunk/fs/reiserfs/ioctl.c @@ -57,6 +57,9 @@ int reiserfs_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, if (get_user(flags, (int __user *)arg)) return -EFAULT; + /* Is it quota file? Do not allow user to mess with it. */ + if (IS_NOQUOTA(inode)) + return -EPERM; if (((flags ^ REISERFS_I(inode)-> i_attrs) & (REISERFS_IMMUTABLE_FL | REISERFS_APPEND_FL))