The patch titled move IMMUTABLE|APPEND checks to notify_change() has been added to the -mm tree. Its filename is move-immutableappend-checks-to-notify_change.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: move IMMUTABLE|APPEND checks to notify_change() From: Kirill Korotaev <dev@xxxxx> Move lots of IMMUTABLE and APPEND flag checks scattered all around to more logical place in notify_change(). Signed-off-by: Dmitry Mishin <dim@xxxxxxxxxx> Signed-off-by: Kirill Korotaev <dev@xxxxxxxxxx> Cc: Christoph Hellwig <hch@xxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- fs/attr.c | 3 +++ fs/open.c | 46 ++++------------------------------------------ 2 files changed, 7 insertions(+), 42 deletions(-) diff -puN fs/attr.c~move-immutableappend-checks-to-notify_change fs/attr.c --- a/fs/attr.c~move-immutableappend-checks-to-notify_change +++ a/fs/attr.c @@ -109,6 +109,9 @@ int notify_change(struct dentry * dentry struct timespec now; unsigned int ia_valid = attr->ia_valid; + if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) + return -EPERM; + mode = inode->i_mode; now = current_fs_time(inode->i_sb); diff -puN fs/open.c~move-immutableappend-checks-to-notify_change fs/open.c --- a/fs/open.c~move-immutableappend-checks-to-notify_change +++ a/fs/open.c @@ -252,10 +252,6 @@ static long do_sys_truncate(const char _ if (IS_RDONLY(inode)) goto dput_and_out; - error = -EPERM; - if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) - goto dput_and_out; - /* * Make sure that there are no leases. */ @@ -316,10 +312,6 @@ static long do_sys_ftruncate(unsigned in if (small && length > MAX_NON_LFS) goto out_putf; - error = -EPERM; - if (IS_APPEND(inode)) - goto out_putf; - error = locks_verify_truncate(inode, file, length); if (!error) error = do_truncate(dentry, length, ATTR_MTIME|ATTR_CTIME, file); @@ -385,10 +377,6 @@ asmlinkage long sys_utime(char __user * /* Don't worry, the checks are done in inode_change_ok() */ newattrs.ia_valid = ATTR_CTIME | ATTR_MTIME | ATTR_ATIME; if (times) { - error = -EPERM; - if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) - goto dput_and_out; - error = get_user(newattrs.ia_atime.tv_sec, ×->actime); newattrs.ia_atime.tv_nsec = 0; if (!error) @@ -398,15 +386,9 @@ asmlinkage long sys_utime(char __user * goto dput_and_out; newattrs.ia_valid |= ATTR_ATIME_SET | ATTR_MTIME_SET; - } else { - error = -EACCES; - if (IS_IMMUTABLE(inode)) - goto dput_and_out; - - if (current->fsuid != inode->i_uid && + } else if (current->fsuid != inode->i_uid && (error = vfs_permission(&nd, MAY_WRITE)) != 0) - goto dput_and_out; - } + goto dput_and_out; mutex_lock(&inode->i_mutex); error = notify_change(nd.dentry, &newattrs); mutex_unlock(&inode->i_mutex); @@ -442,24 +424,14 @@ long do_utimes(int dfd, char __user *fil /* Don't worry, the checks are done in inode_change_ok() */ newattrs.ia_valid = ATTR_CTIME | ATTR_MTIME | ATTR_ATIME; if (times) { - error = -EPERM; - if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) - goto dput_and_out; - newattrs.ia_atime.tv_sec = times[0].tv_sec; newattrs.ia_atime.tv_nsec = times[0].tv_usec * 1000; newattrs.ia_mtime.tv_sec = times[1].tv_sec; newattrs.ia_mtime.tv_nsec = times[1].tv_usec * 1000; newattrs.ia_valid |= ATTR_ATIME_SET | ATTR_MTIME_SET; - } else { - error = -EACCES; - if (IS_IMMUTABLE(inode)) - goto dput_and_out; - - if (current->fsuid != inode->i_uid && + } else if (current->fsuid != inode->i_uid && (error = vfs_permission(&nd, MAY_WRITE)) != 0) - goto dput_and_out; - } + goto dput_and_out; mutex_lock(&inode->i_mutex); error = notify_change(nd.dentry, &newattrs); mutex_unlock(&inode->i_mutex); @@ -639,9 +611,6 @@ asmlinkage long sys_fchmod(unsigned int err = -EROFS; if (IS_RDONLY(inode)) goto out_putf; - err = -EPERM; - if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) - goto out_putf; mutex_lock(&inode->i_mutex); if (mode == (mode_t) -1) mode = inode->i_mode; @@ -673,10 +642,6 @@ asmlinkage long sys_fchmodat(int dfd, co if (IS_RDONLY(inode)) goto dput_and_out; - error = -EPERM; - if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) - goto dput_and_out; - mutex_lock(&inode->i_mutex); if (mode == (mode_t) -1) mode = inode->i_mode; @@ -710,9 +675,6 @@ static int chown_common(struct dentry * error = -EROFS; if (IS_RDONLY(inode)) goto out; - error = -EPERM; - if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) - goto out; newattrs.ia_valid = ATTR_CTIME; if (user != (uid_t) -1) { newattrs.ia_valid |= ATTR_UID; _ Patches currently in -mm which might be from dev@xxxxx are sys_getppid-oopses-on-debug-kernel.patch fix-unserialized-task-files-changing.patch move-immutableappend-checks-to-notify_change.patch ipc-namespace-utils.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html