Commit 83973451 authored by Linus Torvalds's avatar Linus Torvalds

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
parents 59c5f46f e6bc45d6
...@@ -389,7 +389,6 @@ static int usbfs_rmdir(struct inode *dir, struct dentry *dentry) ...@@ -389,7 +389,6 @@ static int usbfs_rmdir(struct inode *dir, struct dentry *dentry)
mutex_unlock(&inode->i_mutex); mutex_unlock(&inode->i_mutex);
if (!error) if (!error)
d_delete(dentry); d_delete(dentry);
dput(dentry);
return error; return error;
} }
......
...@@ -825,7 +825,7 @@ static struct dentry *btrfs_mount(struct file_system_type *fs_type, int flags, ...@@ -825,7 +825,7 @@ static struct dentry *btrfs_mount(struct file_system_type *fs_type, int flags,
} else { } else {
char b[BDEVNAME_SIZE]; char b[BDEVNAME_SIZE];
s->s_flags = flags; s->s_flags = flags | MS_NOSEC;
strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id)); strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id));
error = btrfs_fill_super(s, fs_devices, data, error = btrfs_fill_super(s, fs_devices, data,
flags & MS_SILENT ? 1 : 0); flags & MS_SILENT ? 1 : 0);
......
...@@ -921,6 +921,8 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent) ...@@ -921,6 +921,8 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent)
if (sb->s_flags & MS_MANDLOCK) if (sb->s_flags & MS_MANDLOCK)
goto err; goto err;
sb->s_flags &= ~MS_NOSEC;
if (!parse_fuse_opt((char *) data, &d, is_bdev)) if (!parse_fuse_opt((char *) data, &d, is_bdev))
goto err; goto err;
......
...@@ -1123,7 +1123,7 @@ int lmLogOpen(struct super_block *sb) ...@@ -1123,7 +1123,7 @@ int lmLogOpen(struct super_block *sb)
bdev = blkdev_get_by_dev(sbi->logdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL, bdev = blkdev_get_by_dev(sbi->logdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL,
log); log);
if (IS_ERR(bdev)) { if (IS_ERR(bdev)) {
rc = -PTR_ERR(bdev); rc = PTR_ERR(bdev);
goto free; goto free;
} }
......
...@@ -2624,6 +2624,10 @@ static long do_rmdir(int dfd, const char __user *pathname) ...@@ -2624,6 +2624,10 @@ static long do_rmdir(int dfd, const char __user *pathname)
error = PTR_ERR(dentry); error = PTR_ERR(dentry);
if (IS_ERR(dentry)) if (IS_ERR(dentry))
goto exit2; goto exit2;
if (!dentry->d_inode) {
error = -ENOENT;
goto exit3;
}
error = mnt_want_write(nd.path.mnt); error = mnt_want_write(nd.path.mnt);
if (error) if (error)
goto exit3; goto exit3;
...@@ -2709,11 +2713,10 @@ static long do_unlinkat(int dfd, const char __user *pathname) ...@@ -2709,11 +2713,10 @@ static long do_unlinkat(int dfd, const char __user *pathname)
error = PTR_ERR(dentry); error = PTR_ERR(dentry);
if (!IS_ERR(dentry)) { if (!IS_ERR(dentry)) {
/* Why not before? Because we want correct error value */ /* Why not before? Because we want correct error value */
if (nd.last.name[nd.last.len])
goto slashes;
inode = dentry->d_inode; inode = dentry->d_inode;
if (inode) if (nd.last.name[nd.last.len] || !inode)
ihold(inode); goto slashes;
ihold(inode);
error = mnt_want_write(nd.path.mnt); error = mnt_want_write(nd.path.mnt);
if (error) if (error)
goto exit2; goto exit2;
......
...@@ -1072,7 +1072,7 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) ...@@ -1072,7 +1072,7 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
sb->s_magic = OCFS2_SUPER_MAGIC; sb->s_magic = OCFS2_SUPER_MAGIC;
sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | sb->s_flags = (sb->s_flags & ~(MS_POSIXACL | MS_NOSEC)) |
((osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0); ((osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0);
/* Hard readonly mode only if: bdev_read_only, MS_RDONLY, /* Hard readonly mode only if: bdev_read_only, MS_RDONLY,
......
...@@ -822,7 +822,7 @@ struct dentry *mount_bdev(struct file_system_type *fs_type, ...@@ -822,7 +822,7 @@ struct dentry *mount_bdev(struct file_system_type *fs_type,
} else { } else {
char b[BDEVNAME_SIZE]; char b[BDEVNAME_SIZE];
s->s_flags = flags; s->s_flags = flags | MS_NOSEC;
s->s_mode = mode; s->s_mode = mode;
strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id)); strlcpy(s->s_id, bdevname(bdev, b), sizeof(s->s_id));
sb_set_blocksize(s, block_size(bdev)); sb_set_blocksize(s, block_size(bdev));
......
...@@ -208,6 +208,7 @@ struct inodes_stat_t { ...@@ -208,6 +208,7 @@ struct inodes_stat_t {
#define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */ #define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */
#define MS_I_VERSION (1<<23) /* Update inode I_version field */ #define MS_I_VERSION (1<<23) /* Update inode I_version field */
#define MS_STRICTATIME (1<<24) /* Always perform atime updates */ #define MS_STRICTATIME (1<<24) /* Always perform atime updates */
#define MS_NOSEC (1<<28)
#define MS_BORN (1<<29) #define MS_BORN (1<<29)
#define MS_ACTIVE (1<<30) #define MS_ACTIVE (1<<30)
#define MS_NOUSER (1<<31) #define MS_NOUSER (1<<31)
...@@ -2591,7 +2592,7 @@ static inline int is_sxid(mode_t mode) ...@@ -2591,7 +2592,7 @@ static inline int is_sxid(mode_t mode)
static inline void inode_has_no_xattr(struct inode *inode) static inline void inode_has_no_xattr(struct inode *inode)
{ {
if (!is_sxid(inode->i_mode)) if (!is_sxid(inode->i_mode) && (inode->i_sb->s_flags & MS_NOSEC))
inode->i_flags |= S_NOSEC; inode->i_flags |= S_NOSEC;
} }
......
...@@ -2000,7 +2000,7 @@ int file_remove_suid(struct file *file) ...@@ -2000,7 +2000,7 @@ int file_remove_suid(struct file *file)
error = security_inode_killpriv(dentry); error = security_inode_killpriv(dentry);
if (!error && killsuid) if (!error && killsuid)
error = __remove_suid(dentry, killsuid); error = __remove_suid(dentry, killsuid);
if (!error) if (!error && (inode->i_sb->s_flags & MS_NOSEC))
inode->i_flags |= S_NOSEC; inode->i_flags |= S_NOSEC;
return error; return error;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment