diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-06-07 21:36:59 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-06-07 21:36:59 -0400 |
commit | 8397345172aa5cdcbc133977af9d525f45b874ea (patch) | |
tree | 9b1077a62bbe06d20f1e49d1aa842db0435be085 | |
parent | 59c5f46fbe01a00eedf54a23789634438bb80603 (diff) | |
parent | e6bc45d65df8599fdbae73be9cec4ceed274db53 (diff) |
Merge branch 'for-linus-2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6
* 'for-linus-2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs-2.6:
vfs: make unlink() and rmdir() return ENOENT in preference to EROFS
lmLogOpen() broken failure exit
usb: remove bad dput after dentry_unhash
more conservative S_NOSEC handling
-rw-r--r-- | drivers/usb/core/inode.c | 1 | ||||
-rw-r--r-- | fs/btrfs/super.c | 2 | ||||
-rw-r--r-- | fs/fuse/inode.c | 2 | ||||
-rw-r--r-- | fs/jfs/jfs_logmgr.c | 2 | ||||
-rw-r--r-- | fs/namei.c | 11 | ||||
-rw-r--r-- | fs/ocfs2/super.c | 2 | ||||
-rw-r--r-- | fs/super.c | 2 | ||||
-rw-r--r-- | include/linux/fs.h | 3 | ||||
-rw-r--r-- | mm/filemap.c | 2 |
9 files changed, 16 insertions, 11 deletions
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c index 1b125c224dcf..2278dad886e2 100644 --- a/drivers/usb/core/inode.c +++ b/drivers/usb/core/inode.c | |||
@@ -389,7 +389,6 @@ static int usbfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
389 | mutex_unlock(&inode->i_mutex); | 389 | mutex_unlock(&inode->i_mutex); |
390 | if (!error) | 390 | if (!error) |
391 | d_delete(dentry); | 391 | d_delete(dentry); |
392 | dput(dentry); | ||
393 | return error; | 392 | return error; |
394 | } | 393 | } |
395 | 394 | ||
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 117e74e3604b..0bb4ebbb71b7 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -825,7 +825,7 @@ static struct dentry *btrfs_mount(struct file_system_type *fs_type, int flags, | |||
825 | } else { | 825 | } else { |
826 | char b[BDEVNAME_SIZE]; | 826 | char b[BDEVNAME_SIZE]; |
827 | 827 | ||
828 | s->s_flags = flags; | 828 | s->s_flags = flags | MS_NOSEC; |
829 | strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id)); | 829 | strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id)); |
830 | error = btrfs_fill_super(s, fs_devices, data, | 830 | error = btrfs_fill_super(s, fs_devices, data, |
831 | flags & MS_SILENT ? 1 : 0); | 831 | flags & MS_SILENT ? 1 : 0); |
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index cc6ec4b2f0ff..38f84cd48b67 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c | |||
@@ -921,6 +921,8 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent) | |||
921 | if (sb->s_flags & MS_MANDLOCK) | 921 | if (sb->s_flags & MS_MANDLOCK) |
922 | goto err; | 922 | goto err; |
923 | 923 | ||
924 | sb->s_flags &= ~MS_NOSEC; | ||
925 | |||
924 | if (!parse_fuse_opt((char *) data, &d, is_bdev)) | 926 | if (!parse_fuse_opt((char *) data, &d, is_bdev)) |
925 | goto err; | 927 | goto err; |
926 | 928 | ||
diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c index 278e3fb40b71..583636f745e5 100644 --- a/fs/jfs/jfs_logmgr.c +++ b/fs/jfs/jfs_logmgr.c | |||
@@ -1123,7 +1123,7 @@ int lmLogOpen(struct super_block *sb) | |||
1123 | bdev = blkdev_get_by_dev(sbi->logdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL, | 1123 | bdev = blkdev_get_by_dev(sbi->logdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL, |
1124 | log); | 1124 | log); |
1125 | if (IS_ERR(bdev)) { | 1125 | if (IS_ERR(bdev)) { |
1126 | rc = -PTR_ERR(bdev); | 1126 | rc = PTR_ERR(bdev); |
1127 | goto free; | 1127 | goto free; |
1128 | } | 1128 | } |
1129 | 1129 | ||
diff --git a/fs/namei.c b/fs/namei.c index e2e4e8d032ee..9802345df5e7 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -2624,6 +2624,10 @@ static long do_rmdir(int dfd, const char __user *pathname) | |||
2624 | error = PTR_ERR(dentry); | 2624 | error = PTR_ERR(dentry); |
2625 | if (IS_ERR(dentry)) | 2625 | if (IS_ERR(dentry)) |
2626 | goto exit2; | 2626 | goto exit2; |
2627 | if (!dentry->d_inode) { | ||
2628 | error = -ENOENT; | ||
2629 | goto exit3; | ||
2630 | } | ||
2627 | error = mnt_want_write(nd.path.mnt); | 2631 | error = mnt_want_write(nd.path.mnt); |
2628 | if (error) | 2632 | if (error) |
2629 | goto exit3; | 2633 | goto exit3; |
@@ -2709,11 +2713,10 @@ static long do_unlinkat(int dfd, const char __user *pathname) | |||
2709 | error = PTR_ERR(dentry); | 2713 | error = PTR_ERR(dentry); |
2710 | if (!IS_ERR(dentry)) { | 2714 | if (!IS_ERR(dentry)) { |
2711 | /* Why not before? Because we want correct error value */ | 2715 | /* Why not before? Because we want correct error value */ |
2712 | if (nd.last.name[nd.last.len]) | ||
2713 | goto slashes; | ||
2714 | inode = dentry->d_inode; | 2716 | inode = dentry->d_inode; |
2715 | if (inode) | 2717 | if (nd.last.name[nd.last.len] || !inode) |
2716 | ihold(inode); | 2718 | goto slashes; |
2719 | ihold(inode); | ||
2717 | error = mnt_want_write(nd.path.mnt); | 2720 | error = mnt_want_write(nd.path.mnt); |
2718 | if (error) | 2721 | if (error) |
2719 | goto exit2; | 2722 | goto exit2; |
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index cdbaf5e97308..56f61027236b 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -1072,7 +1072,7 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) | |||
1072 | 1072 | ||
1073 | sb->s_magic = OCFS2_SUPER_MAGIC; | 1073 | sb->s_magic = OCFS2_SUPER_MAGIC; |
1074 | 1074 | ||
1075 | sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | | 1075 | sb->s_flags = (sb->s_flags & ~(MS_POSIXACL | MS_NOSEC)) | |
1076 | ((osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0); | 1076 | ((osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0); |
1077 | 1077 | ||
1078 | /* Hard readonly mode only if: bdev_read_only, MS_RDONLY, | 1078 | /* Hard readonly mode only if: bdev_read_only, MS_RDONLY, |
diff --git a/fs/super.c b/fs/super.c index c75593953c52..ab3d672db0de 100644 --- a/fs/super.c +++ b/fs/super.c | |||
@@ -822,7 +822,7 @@ struct dentry *mount_bdev(struct file_system_type *fs_type, | |||
822 | } else { | 822 | } else { |
823 | char b[BDEVNAME_SIZE]; | 823 | char b[BDEVNAME_SIZE]; |
824 | 824 | ||
825 | s->s_flags = flags; | 825 | s->s_flags = flags | MS_NOSEC; |
826 | s->s_mode = mode; | 826 | s->s_mode = mode; |
827 | strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id)); | 827 | strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id)); |
828 | sb_set_blocksize(s, block_size(bdev)); | 828 | sb_set_blocksize(s, block_size(bdev)); |
diff --git a/include/linux/fs.h b/include/linux/fs.h index c55d6b7cd5d6..646a1836152a 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -208,6 +208,7 @@ struct inodes_stat_t { | |||
208 | #define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */ | 208 | #define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */ |
209 | #define MS_I_VERSION (1<<23) /* Update inode I_version field */ | 209 | #define MS_I_VERSION (1<<23) /* Update inode I_version field */ |
210 | #define MS_STRICTATIME (1<<24) /* Always perform atime updates */ | 210 | #define MS_STRICTATIME (1<<24) /* Always perform atime updates */ |
211 | #define MS_NOSEC (1<<28) | ||
211 | #define MS_BORN (1<<29) | 212 | #define MS_BORN (1<<29) |
212 | #define MS_ACTIVE (1<<30) | 213 | #define MS_ACTIVE (1<<30) |
213 | #define MS_NOUSER (1<<31) | 214 | #define MS_NOUSER (1<<31) |
@@ -2591,7 +2592,7 @@ static inline int is_sxid(mode_t mode) | |||
2591 | 2592 | ||
2592 | static inline void inode_has_no_xattr(struct inode *inode) | 2593 | static inline void inode_has_no_xattr(struct inode *inode) |
2593 | { | 2594 | { |
2594 | if (!is_sxid(inode->i_mode)) | 2595 | if (!is_sxid(inode->i_mode) && (inode->i_sb->s_flags & MS_NOSEC)) |
2595 | inode->i_flags |= S_NOSEC; | 2596 | inode->i_flags |= S_NOSEC; |
2596 | } | 2597 | } |
2597 | 2598 | ||
diff --git a/mm/filemap.c b/mm/filemap.c index d7b10578a64b..a8251a8d3457 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -2000,7 +2000,7 @@ int file_remove_suid(struct file *file) | |||
2000 | error = security_inode_killpriv(dentry); | 2000 | error = security_inode_killpriv(dentry); |
2001 | if (!error && killsuid) | 2001 | if (!error && killsuid) |
2002 | error = __remove_suid(dentry, killsuid); | 2002 | error = __remove_suid(dentry, killsuid); |
2003 | if (!error) | 2003 | if (!error && (inode->i_sb->s_flags & MS_NOSEC)) |
2004 | inode->i_flags |= S_NOSEC; | 2004 | inode->i_flags |= S_NOSEC; |
2005 | 2005 | ||
2006 | return error; | 2006 | return error; |