Commit efc518eb authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

Pull vfs fixes from Al Viro:
 "Several obvious fixes"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  Fix mountpoint reference leakage in linkat
  hfsplus: use xattr handlers for removexattr
  Typo in compat_sys_lseek() declaration
  fs/super.c: sync ro remount after blocking writers
  vfs: unexport the getname() symbol
parents fea8893d d22e6338
...@@ -529,7 +529,7 @@ const struct inode_operations hfsplus_dir_inode_operations = { ...@@ -529,7 +529,7 @@ const struct inode_operations hfsplus_dir_inode_operations = {
.setxattr = generic_setxattr, .setxattr = generic_setxattr,
.getxattr = generic_getxattr, .getxattr = generic_getxattr,
.listxattr = hfsplus_listxattr, .listxattr = hfsplus_listxattr,
.removexattr = hfsplus_removexattr, .removexattr = generic_removexattr,
#ifdef CONFIG_HFSPLUS_FS_POSIX_ACL #ifdef CONFIG_HFSPLUS_FS_POSIX_ACL
.get_acl = hfsplus_get_posix_acl, .get_acl = hfsplus_get_posix_acl,
.set_acl = hfsplus_set_posix_acl, .set_acl = hfsplus_set_posix_acl,
......
...@@ -331,7 +331,7 @@ static const struct inode_operations hfsplus_file_inode_operations = { ...@@ -331,7 +331,7 @@ static const struct inode_operations hfsplus_file_inode_operations = {
.setxattr = generic_setxattr, .setxattr = generic_setxattr,
.getxattr = generic_getxattr, .getxattr = generic_getxattr,
.listxattr = hfsplus_listxattr, .listxattr = hfsplus_listxattr,
.removexattr = hfsplus_removexattr, .removexattr = generic_removexattr,
#ifdef CONFIG_HFSPLUS_FS_POSIX_ACL #ifdef CONFIG_HFSPLUS_FS_POSIX_ACL
.get_acl = hfsplus_get_posix_acl, .get_acl = hfsplus_get_posix_acl,
.set_acl = hfsplus_set_posix_acl, .set_acl = hfsplus_set_posix_acl,
......
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
#include "xattr.h" #include "xattr.h"
#include "acl.h" #include "acl.h"
static int hfsplus_removexattr(struct inode *inode, const char *name);
const struct xattr_handler *hfsplus_xattr_handlers[] = { const struct xattr_handler *hfsplus_xattr_handlers[] = {
&hfsplus_xattr_osx_handler, &hfsplus_xattr_osx_handler,
&hfsplus_xattr_user_handler, &hfsplus_xattr_user_handler,
...@@ -274,14 +276,8 @@ int __hfsplus_setxattr(struct inode *inode, const char *name, ...@@ -274,14 +276,8 @@ int __hfsplus_setxattr(struct inode *inode, const char *name,
HFSPLUS_IS_RSRC(inode)) HFSPLUS_IS_RSRC(inode))
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (strncmp(name, XATTR_MAC_OSX_PREFIX, if (value == NULL)
XATTR_MAC_OSX_PREFIX_LEN) == 0) return hfsplus_removexattr(inode, name);
name += XATTR_MAC_OSX_PREFIX_LEN;
if (value == NULL) {
value = "";
size = 0;
}
err = hfs_find_init(HFSPLUS_SB(inode->i_sb)->cat_tree, &cat_fd); err = hfs_find_init(HFSPLUS_SB(inode->i_sb)->cat_tree, &cat_fd);
if (err) { if (err) {
...@@ -399,16 +395,11 @@ int __hfsplus_setxattr(struct inode *inode, const char *name, ...@@ -399,16 +395,11 @@ int __hfsplus_setxattr(struct inode *inode, const char *name,
return err; return err;
} }
static inline int is_osx_xattr(const char *xattr_name)
{
return !is_known_namespace(xattr_name);
}
static int name_len(const char *xattr_name, int xattr_name_len) static int name_len(const char *xattr_name, int xattr_name_len)
{ {
int len = xattr_name_len + 1; int len = xattr_name_len + 1;
if (is_osx_xattr(xattr_name)) if (!is_known_namespace(xattr_name))
len += XATTR_MAC_OSX_PREFIX_LEN; len += XATTR_MAC_OSX_PREFIX_LEN;
return len; return len;
...@@ -419,7 +410,7 @@ static int copy_name(char *buffer, const char *xattr_name, int name_len) ...@@ -419,7 +410,7 @@ static int copy_name(char *buffer, const char *xattr_name, int name_len)
int len = name_len; int len = name_len;
int offset = 0; int offset = 0;
if (is_osx_xattr(xattr_name)) { if (!is_known_namespace(xattr_name)) {
strncpy(buffer, XATTR_MAC_OSX_PREFIX, XATTR_MAC_OSX_PREFIX_LEN); strncpy(buffer, XATTR_MAC_OSX_PREFIX, XATTR_MAC_OSX_PREFIX_LEN);
offset += XATTR_MAC_OSX_PREFIX_LEN; offset += XATTR_MAC_OSX_PREFIX_LEN;
len += XATTR_MAC_OSX_PREFIX_LEN; len += XATTR_MAC_OSX_PREFIX_LEN;
...@@ -497,18 +488,6 @@ ssize_t __hfsplus_getxattr(struct inode *inode, const char *name, ...@@ -497,18 +488,6 @@ ssize_t __hfsplus_getxattr(struct inode *inode, const char *name,
HFSPLUS_IS_RSRC(inode)) HFSPLUS_IS_RSRC(inode))
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (strncmp(name, XATTR_MAC_OSX_PREFIX,
XATTR_MAC_OSX_PREFIX_LEN) == 0) {
/* skip "osx." prefix */
name += XATTR_MAC_OSX_PREFIX_LEN;
/*
* Don't allow retrieving properly prefixed attributes
* by prepending them with "osx."
*/
if (is_known_namespace(name))
return -EOPNOTSUPP;
}
if (!strcmp_xattr_finder_info(name)) if (!strcmp_xattr_finder_info(name))
return hfsplus_getxattr_finder_info(inode, value, size); return hfsplus_getxattr_finder_info(inode, value, size);
...@@ -743,28 +722,18 @@ ssize_t hfsplus_listxattr(struct dentry *dentry, char *buffer, size_t size) ...@@ -743,28 +722,18 @@ ssize_t hfsplus_listxattr(struct dentry *dentry, char *buffer, size_t size)
return res; return res;
} }
int hfsplus_removexattr(struct dentry *dentry, const char *name) static int hfsplus_removexattr(struct inode *inode, const char *name)
{ {
int err = 0; int err = 0;
struct inode *inode = dentry->d_inode;
struct hfs_find_data cat_fd; struct hfs_find_data cat_fd;
u16 flags; u16 flags;
u16 cat_entry_type; u16 cat_entry_type;
int is_xattr_acl_deleted = 0; int is_xattr_acl_deleted = 0;
int is_all_xattrs_deleted = 0; int is_all_xattrs_deleted = 0;
if ((!S_ISREG(inode->i_mode) &&
!S_ISDIR(inode->i_mode)) ||
HFSPLUS_IS_RSRC(inode))
return -EOPNOTSUPP;
if (!HFSPLUS_SB(inode->i_sb)->attr_tree) if (!HFSPLUS_SB(inode->i_sb)->attr_tree)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (strncmp(name, XATTR_MAC_OSX_PREFIX,
XATTR_MAC_OSX_PREFIX_LEN) == 0)
name += XATTR_MAC_OSX_PREFIX_LEN;
if (!strcmp_xattr_finder_info(name)) if (!strcmp_xattr_finder_info(name))
return -EOPNOTSUPP; return -EOPNOTSUPP;
...@@ -838,8 +807,12 @@ static int hfsplus_osx_getxattr(struct dentry *dentry, const char *name, ...@@ -838,8 +807,12 @@ static int hfsplus_osx_getxattr(struct dentry *dentry, const char *name,
if (len > HFSPLUS_ATTR_MAX_STRLEN) if (len > HFSPLUS_ATTR_MAX_STRLEN)
return -EOPNOTSUPP; return -EOPNOTSUPP;
strcpy(xattr_name, XATTR_MAC_OSX_PREFIX); /*
strcpy(xattr_name + XATTR_MAC_OSX_PREFIX_LEN, name); * Don't allow retrieving properly prefixed attributes
* by prepending them with "osx."
*/
if (is_known_namespace(name))
return -EOPNOTSUPP;
return hfsplus_getxattr(dentry, xattr_name, buffer, size); return hfsplus_getxattr(dentry, xattr_name, buffer, size);
} }
...@@ -857,12 +830,13 @@ static int hfsplus_osx_setxattr(struct dentry *dentry, const char *name, ...@@ -857,12 +830,13 @@ static int hfsplus_osx_setxattr(struct dentry *dentry, const char *name,
if (len > HFSPLUS_ATTR_MAX_STRLEN) if (len > HFSPLUS_ATTR_MAX_STRLEN)
return -EOPNOTSUPP; return -EOPNOTSUPP;
/*
* Don't allow setting properly prefixed attributes
* by prepending them with "osx."
*/
if (is_known_namespace(name)) if (is_known_namespace(name))
return -EOPNOTSUPP; return -EOPNOTSUPP;
strcpy(xattr_name, XATTR_MAC_OSX_PREFIX);
strcpy(xattr_name + XATTR_MAC_OSX_PREFIX_LEN, name);
return hfsplus_setxattr(dentry, xattr_name, buffer, size, flags); return hfsplus_setxattr(dentry, xattr_name, buffer, size, flags);
} }
......
...@@ -40,8 +40,6 @@ static inline ssize_t hfsplus_getxattr(struct dentry *dentry, ...@@ -40,8 +40,6 @@ static inline ssize_t hfsplus_getxattr(struct dentry *dentry,
ssize_t hfsplus_listxattr(struct dentry *dentry, char *buffer, size_t size); ssize_t hfsplus_listxattr(struct dentry *dentry, char *buffer, size_t size);
int hfsplus_removexattr(struct dentry *dentry, const char *name);
int hfsplus_init_security(struct inode *inode, struct inode *dir, int hfsplus_init_security(struct inode *inode, struct inode *dir,
const struct qstr *qstr); const struct qstr *qstr);
......
...@@ -209,7 +209,6 @@ getname(const char __user * filename) ...@@ -209,7 +209,6 @@ getname(const char __user * filename)
{ {
return getname_flags(filename, 0, NULL); return getname_flags(filename, 0, NULL);
} }
EXPORT_SYMBOL(getname);
#ifdef CONFIG_AUDITSYSCALL #ifdef CONFIG_AUDITSYSCALL
void putname(struct filename *name) void putname(struct filename *name)
...@@ -3927,10 +3926,13 @@ SYSCALL_DEFINE5(linkat, int, olddfd, const char __user *, oldname, ...@@ -3927,10 +3926,13 @@ SYSCALL_DEFINE5(linkat, int, olddfd, const char __user *, oldname,
done_path_create(&new_path, new_dentry); done_path_create(&new_path, new_dentry);
if (delegated_inode) { if (delegated_inode) {
error = break_deleg_wait(&delegated_inode); error = break_deleg_wait(&delegated_inode);
if (!error) if (!error) {
path_put(&old_path);
goto retry; goto retry;
}
} }
if (retry_estale(error, how)) { if (retry_estale(error, how)) {
path_put(&old_path);
how |= LOOKUP_REVAL; how |= LOOKUP_REVAL;
goto retry; goto retry;
} }
......
...@@ -703,7 +703,6 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force) ...@@ -703,7 +703,6 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force)
if (flags & MS_RDONLY) if (flags & MS_RDONLY)
acct_auto_close(sb); acct_auto_close(sb);
shrink_dcache_sb(sb); shrink_dcache_sb(sb);
sync_filesystem(sb);
remount_ro = (flags & MS_RDONLY) && !(sb->s_flags & MS_RDONLY); remount_ro = (flags & MS_RDONLY) && !(sb->s_flags & MS_RDONLY);
...@@ -720,6 +719,8 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force) ...@@ -720,6 +719,8 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force)
} }
} }
sync_filesystem(sb);
if (sb->s_op->remount_fs) { if (sb->s_op->remount_fs) {
retval = sb->s_op->remount_fs(sb, &flags, data); retval = sb->s_op->remount_fs(sb, &flags, data);
if (retval) { if (retval) {
......
...@@ -337,7 +337,7 @@ asmlinkage ssize_t compat_sys_preadv(compat_ulong_t fd, ...@@ -337,7 +337,7 @@ asmlinkage ssize_t compat_sys_preadv(compat_ulong_t fd,
asmlinkage ssize_t compat_sys_pwritev(compat_ulong_t fd, asmlinkage ssize_t compat_sys_pwritev(compat_ulong_t fd,
const struct compat_iovec __user *vec, const struct compat_iovec __user *vec,
compat_ulong_t vlen, u32 pos_low, u32 pos_high); compat_ulong_t vlen, u32 pos_low, u32 pos_high);
asmlinkage long comat_sys_lseek(unsigned int, compat_off_t, unsigned int); asmlinkage long compat_sys_lseek(unsigned int, compat_off_t, unsigned int);
asmlinkage long compat_sys_execve(const char __user *filename, const compat_uptr_t __user *argv, asmlinkage long compat_sys_execve(const char __user *filename, const compat_uptr_t __user *argv,
const compat_uptr_t __user *envp); const compat_uptr_t __user *envp);
......
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