summaryrefslogtreecommitdiffstats
path: root/fs/ext4
diff options
context:
space:
mode:
authorJan Kara2007-11-15 01:58:56 +0100
committerLinus Torvalds2007-11-15 03:45:38 +0100
commite47776a0a41a14a5634633c96e590827f552c4b5 (patch)
tree44d5168b83fb1d8d72668728c690116d34f6711f /fs/ext4
parentdrivers/video/s1d13xxxfb.c: fix build as module with dbg (diff)
downloadkernel-qcow2-linux-e47776a0a41a14a5634633c96e590827f552c4b5.tar.gz
kernel-qcow2-linux-e47776a0a41a14a5634633c96e590827f552c4b5.tar.xz
kernel-qcow2-linux-e47776a0a41a14a5634633c96e590827f552c4b5.zip
Forbid user to change file flags on quota files
Forbid user from changing file flags on quota files. User has no bussiness in playing with these flags when quota is on. Furthermore there is a remote possibility of deadlock due to a lock inversion between quota file's i_mutex and transaction's start (i_mutex for quota file is locked only when trasaction is started in quota operations) in ext3 and ext4. Signed-off-by: Jan Kara <jack@suse.cz> Cc: LIOU Payphone <lioupayphone@gmail.com> Cc: <linux-ext4@vger.kernel.org> Acked-by: Dave Kleikamp <shaggy@austin.ibm.com> Cc: <reiserfs-dev@namesys.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/ioctl.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
index c04c7ccba9e3..e7f894bdb420 100644
--- a/fs/ext4/ioctl.c
+++ b/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 */