Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 211568
b: refs/heads/master
c: 6333816
h: refs/heads/master
v: v3
  • Loading branch information
Christoph Hellwig committed Oct 1, 2010
1 parent 87b1bec commit 64736f8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 94744567fef9602c3d8218a1d8f58c04cce354f6
refs/heads/master: 6333816ade7e04a96ec0a34a8378c455e4f7c4dd
15 changes: 8 additions & 7 deletions trunk/fs/hfsplus/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include <linux/mount.h>
#include <linux/sched.h>
#include <linux/xattr.h>
#include <linux/smp_lock.h>
#include <asm/uaccess.h>
#include "hfsplus_fs.h"

Expand All @@ -42,10 +41,9 @@ static int hfsplus_ioctl_setflags(struct file *file, int __user *user_flags)
unsigned int flags;
int err = 0;

lock_kernel();
err = mnt_want_write(file->f_path.mnt);
if (err)
goto out_unlock_kernel;
goto out;

if (!is_owner_or_cap(inode)) {
err = -EACCES;
Expand All @@ -57,18 +55,20 @@ static int hfsplus_ioctl_setflags(struct file *file, int __user *user_flags)
goto out_drop_write;
}

mutex_lock(&inode->i_mutex);

if (flags & (FS_IMMUTABLE_FL|FS_APPEND_FL) ||
HFSPLUS_I(inode).rootflags & (HFSPLUS_FLG_IMMUTABLE|HFSPLUS_FLG_APPEND)) {
if (!capable(CAP_LINUX_IMMUTABLE)) {
err = -EPERM;
goto out_drop_write;
goto out_unlock_inode;
}
}

/* don't silently ignore unsupported ext2 flags */
if (flags & ~(FS_IMMUTABLE_FL|FS_APPEND_FL|FS_NODUMP_FL)) {
err = -EOPNOTSUPP;
goto out_drop_write;
goto out_unlock_inode;
}
if (flags & FS_IMMUTABLE_FL) {
inode->i_flags |= S_IMMUTABLE;
Expand All @@ -92,10 +92,11 @@ static int hfsplus_ioctl_setflags(struct file *file, int __user *user_flags)
inode->i_ctime = CURRENT_TIME_SEC;
mark_inode_dirty(inode);

out_unlock_inode:
mutex_lock(&inode->i_mutex);
out_drop_write:
mnt_drop_write(file->f_path.mnt);
out_unlock_kernel:
unlock_kernel();
out:
return err;
}

Expand Down

0 comments on commit 64736f8

Please sign in to comment.