diff options
Diffstat (limited to 'fs/ext2/ioctl.c')
-rw-r--r-- | fs/ext2/ioctl.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/ext2/ioctl.c b/fs/ext2/ioctl.c index 1dfba77eab10..e3cf8c81507f 100644 --- a/fs/ext2/ioctl.c +++ b/fs/ext2/ioctl.c | |||
@@ -44,6 +44,7 @@ int ext2_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, | |||
44 | if (!S_ISDIR(inode->i_mode)) | 44 | if (!S_ISDIR(inode->i_mode)) |
45 | flags &= ~EXT2_DIRSYNC_FL; | 45 | flags &= ~EXT2_DIRSYNC_FL; |
46 | 46 | ||
47 | mutex_lock(&inode->i_mutex); | ||
47 | oldflags = ei->i_flags; | 48 | oldflags = ei->i_flags; |
48 | 49 | ||
49 | /* | 50 | /* |
@@ -53,13 +54,16 @@ int ext2_ioctl (struct inode * inode, struct file * filp, unsigned int cmd, | |||
53 | * This test looks nicer. Thanks to Pauline Middelink | 54 | * This test looks nicer. Thanks to Pauline Middelink |
54 | */ | 55 | */ |
55 | if ((flags ^ oldflags) & (EXT2_APPEND_FL | EXT2_IMMUTABLE_FL)) { | 56 | if ((flags ^ oldflags) & (EXT2_APPEND_FL | EXT2_IMMUTABLE_FL)) { |
56 | if (!capable(CAP_LINUX_IMMUTABLE)) | 57 | if (!capable(CAP_LINUX_IMMUTABLE)) { |
58 | mutex_unlock(&inode->i_mutex); | ||
57 | return -EPERM; | 59 | return -EPERM; |
60 | } | ||
58 | } | 61 | } |
59 | 62 | ||
60 | flags = flags & EXT2_FL_USER_MODIFIABLE; | 63 | flags = flags & EXT2_FL_USER_MODIFIABLE; |
61 | flags |= oldflags & ~EXT2_FL_USER_MODIFIABLE; | 64 | flags |= oldflags & ~EXT2_FL_USER_MODIFIABLE; |
62 | ei->i_flags = flags; | 65 | ei->i_flags = flags; |
66 | mutex_unlock(&inode->i_mutex); | ||
63 | 67 | ||
64 | ext2_set_inode_flags(inode); | 68 | ext2_set_inode_flags(inode); |
65 | inode->i_ctime = CURRENT_TIME_SEC; | 69 | inode->i_ctime = CURRENT_TIME_SEC; |