diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-17 09:04:38 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-04-17 09:04:38 -0400 |
| commit | 54e514b91b95d6441c12a7955addfb9f9d2afc65 (patch) | |
| tree | 8b73d901bd2a6ec5a31f34a8954e5ea92216dd6c /fs/hfsplus | |
| parent | 4fc8adcfec3da639da76e8314c9ccefe5bf9a045 (diff) | |
| parent | 6c8c90319c0bb1c9e0b68e721359b89ae4f28465 (diff) | |
Merge branch 'akpm' (patches from Andrew)
Merge third patchbomb from Andrew Morton:
- various misc things
- a couple of lib/ optimisations
- provide DIV_ROUND_CLOSEST_ULL()
- checkpatch updates
- rtc tree
- befs, nilfs2, hfs, hfsplus, fatfs, adfs, affs, bfs
- ptrace fixes
- fork() fixes
- seccomp cleanups
- more mmap_sem hold time reductions from Davidlohr
* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (138 commits)
proc: show locks in /proc/pid/fdinfo/X
docs: add missing and new /proc/PID/status file entries, fix typos
drivers/rtc/rtc-at91rm9200.c: make IO endian agnostic
Documentation/spi/spidev_test.c: fix warning
drivers/rtc/rtc-s5m.c: allow usage on device type different than main MFD type
.gitignore: ignore *.tar
MAINTAINERS: add Mediatek SoC mailing list
tomoyo: reduce mmap_sem hold for mm->exe_file
powerpc/oprofile: reduce mmap_sem hold for exe_file
oprofile: reduce mmap_sem hold for mm->exe_file
mips: ip32: add platform data hooks to use DS1685 driver
lib/Kconfig: fix up HAVE_ARCH_BITREVERSE help text
x86: switch to using asm-generic for seccomp.h
sparc: switch to using asm-generic for seccomp.h
powerpc: switch to using asm-generic for seccomp.h
parisc: switch to using asm-generic for seccomp.h
mips: switch to using asm-generic for seccomp.h
microblaze: use asm-generic for seccomp.h
arm: use asm-generic for seccomp.h
seccomp: allow COMPAT sigreturn overrides
...
Diffstat (limited to 'fs/hfsplus')
| -rw-r--r-- | fs/hfsplus/bfind.c | 4 | ||||
| -rw-r--r-- | fs/hfsplus/catalog.c | 3 | ||||
| -rw-r--r-- | fs/hfsplus/dir.c | 4 | ||||
| -rw-r--r-- | fs/hfsplus/inode.c | 6 | ||||
| -rw-r--r-- | fs/hfsplus/ioctl.c | 12 | ||||
| -rw-r--r-- | fs/hfsplus/xattr.c | 86 | ||||
| -rw-r--r-- | fs/hfsplus/xattr.h | 22 | ||||
| -rw-r--r-- | fs/hfsplus/xattr_security.c | 38 | ||||
| -rw-r--r-- | fs/hfsplus/xattr_trusted.c | 37 | ||||
| -rw-r--r-- | fs/hfsplus/xattr_user.c | 35 |
10 files changed, 100 insertions, 147 deletions
diff --git a/fs/hfsplus/bfind.c b/fs/hfsplus/bfind.c index c1422d91cd36..528e38b5af7f 100644 --- a/fs/hfsplus/bfind.c +++ b/fs/hfsplus/bfind.c | |||
| @@ -118,9 +118,7 @@ int __hfs_brec_find(struct hfs_bnode *bnode, struct hfs_find_data *fd, | |||
| 118 | int b, e; | 118 | int b, e; |
| 119 | int res; | 119 | int res; |
| 120 | 120 | ||
| 121 | if (!rec_found) | 121 | BUG_ON(!rec_found); |
| 122 | BUG(); | ||
| 123 | |||
| 124 | b = 0; | 122 | b = 0; |
| 125 | e = bnode->num_recs - 1; | 123 | e = bnode->num_recs - 1; |
| 126 | res = -ENOENT; | 124 | res = -ENOENT; |
diff --git a/fs/hfsplus/catalog.c b/fs/hfsplus/catalog.c index 7892e6fddb66..022974ab6e3c 100644 --- a/fs/hfsplus/catalog.c +++ b/fs/hfsplus/catalog.c | |||
| @@ -350,10 +350,11 @@ int hfsplus_delete_cat(u32 cnid, struct inode *dir, struct qstr *str) | |||
| 350 | &fd.search_key->cat.name.unicode, | 350 | &fd.search_key->cat.name.unicode, |
| 351 | off + 2, len); | 351 | off + 2, len); |
| 352 | fd.search_key->key_len = cpu_to_be16(6 + len); | 352 | fd.search_key->key_len = cpu_to_be16(6 + len); |
| 353 | } else | 353 | } else { |
| 354 | err = hfsplus_cat_build_key(sb, fd.search_key, dir->i_ino, str); | 354 | err = hfsplus_cat_build_key(sb, fd.search_key, dir->i_ino, str); |
| 355 | if (unlikely(err)) | 355 | if (unlikely(err)) |
| 356 | goto out; | 356 | goto out; |
| 357 | } | ||
| 357 | 358 | ||
| 358 | err = hfs_brec_find(&fd, hfs_find_rec_by_key); | 359 | err = hfs_brec_find(&fd, hfs_find_rec_by_key); |
| 359 | if (err) | 360 | if (err) |
diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c index f0235c1640af..3074609befc3 100644 --- a/fs/hfsplus/dir.c +++ b/fs/hfsplus/dir.c | |||
| @@ -434,7 +434,7 @@ static int hfsplus_symlink(struct inode *dir, struct dentry *dentry, | |||
| 434 | { | 434 | { |
| 435 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb); | 435 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb); |
| 436 | struct inode *inode; | 436 | struct inode *inode; |
| 437 | int res = -ENOSPC; | 437 | int res = -ENOMEM; |
| 438 | 438 | ||
| 439 | mutex_lock(&sbi->vh_mutex); | 439 | mutex_lock(&sbi->vh_mutex); |
| 440 | inode = hfsplus_new_inode(dir->i_sb, S_IFLNK | S_IRWXUGO); | 440 | inode = hfsplus_new_inode(dir->i_sb, S_IFLNK | S_IRWXUGO); |
| @@ -476,7 +476,7 @@ static int hfsplus_mknod(struct inode *dir, struct dentry *dentry, | |||
| 476 | { | 476 | { |
| 477 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb); | 477 | struct hfsplus_sb_info *sbi = HFSPLUS_SB(dir->i_sb); |
| 478 | struct inode *inode; | 478 | struct inode *inode; |
| 479 | int res = -ENOSPC; | 479 | int res = -ENOMEM; |
| 480 | 480 | ||
| 481 | mutex_lock(&sbi->vh_mutex); | 481 | mutex_lock(&sbi->vh_mutex); |
| 482 | inode = hfsplus_new_inode(dir->i_sb, mode); | 482 | inode = hfsplus_new_inode(dir->i_sb, mode); |
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c index a43811f90935..b0afedbef12b 100644 --- a/fs/hfsplus/inode.c +++ b/fs/hfsplus/inode.c | |||
| @@ -253,6 +253,12 @@ static int hfsplus_setattr(struct dentry *dentry, struct iattr *attr) | |||
| 253 | if ((attr->ia_valid & ATTR_SIZE) && | 253 | if ((attr->ia_valid & ATTR_SIZE) && |
| 254 | attr->ia_size != i_size_read(inode)) { | 254 | attr->ia_size != i_size_read(inode)) { |
| 255 | inode_dio_wait(inode); | 255 | inode_dio_wait(inode); |
| 256 | if (attr->ia_size > inode->i_size) { | ||
| 257 | error = generic_cont_expand_simple(inode, | ||
| 258 | attr->ia_size); | ||
| 259 | if (error) | ||
| 260 | return error; | ||
| 261 | } | ||
| 256 | truncate_setsize(inode, attr->ia_size); | 262 | truncate_setsize(inode, attr->ia_size); |
| 257 | hfsplus_file_truncate(inode); | 263 | hfsplus_file_truncate(inode); |
| 258 | } | 264 | } |
diff --git a/fs/hfsplus/ioctl.c b/fs/hfsplus/ioctl.c index d3ff5cc317d7..8e98f5db6ad6 100644 --- a/fs/hfsplus/ioctl.c +++ b/fs/hfsplus/ioctl.c | |||
| @@ -76,7 +76,7 @@ static int hfsplus_ioctl_setflags(struct file *file, int __user *user_flags) | |||
| 76 | { | 76 | { |
| 77 | struct inode *inode = file_inode(file); | 77 | struct inode *inode = file_inode(file); |
| 78 | struct hfsplus_inode_info *hip = HFSPLUS_I(inode); | 78 | struct hfsplus_inode_info *hip = HFSPLUS_I(inode); |
| 79 | unsigned int flags; | 79 | unsigned int flags, new_fl = 0; |
| 80 | int err = 0; | 80 | int err = 0; |
| 81 | 81 | ||
| 82 | err = mnt_want_write_file(file); | 82 | err = mnt_want_write_file(file); |
| @@ -110,14 +110,12 @@ static int hfsplus_ioctl_setflags(struct file *file, int __user *user_flags) | |||
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | if (flags & FS_IMMUTABLE_FL) | 112 | if (flags & FS_IMMUTABLE_FL) |
| 113 | inode->i_flags |= S_IMMUTABLE; | 113 | new_fl |= S_IMMUTABLE; |
| 114 | else | ||
| 115 | inode->i_flags &= ~S_IMMUTABLE; | ||
| 116 | 114 | ||
| 117 | if (flags & FS_APPEND_FL) | 115 | if (flags & FS_APPEND_FL) |
| 118 | inode->i_flags |= S_APPEND; | 116 | new_fl |= S_APPEND; |
| 119 | else | 117 | |
| 120 | inode->i_flags &= ~S_APPEND; | 118 | inode_set_flags(inode, new_fl, S_IMMUTABLE | S_APPEND); |
| 121 | 119 | ||
| 122 | if (flags & FS_NODUMP_FL) | 120 | if (flags & FS_NODUMP_FL) |
| 123 | hip->userflags |= HFSPLUS_FLG_NODUMP; | 121 | hip->userflags |= HFSPLUS_FLG_NODUMP; |
diff --git a/fs/hfsplus/xattr.c b/fs/hfsplus/xattr.c index d98094a9f476..89f262d8fcd8 100644 --- a/fs/hfsplus/xattr.c +++ b/fs/hfsplus/xattr.c | |||
| @@ -44,7 +44,7 @@ static int strcmp_xattr_acl(const char *name) | |||
| 44 | return -1; | 44 | return -1; |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | static inline int is_known_namespace(const char *name) | 47 | static bool is_known_namespace(const char *name) |
| 48 | { | 48 | { |
| 49 | if (strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN) && | 49 | if (strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN) && |
| 50 | strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN) && | 50 | strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN) && |
| @@ -424,6 +424,28 @@ static int copy_name(char *buffer, const char *xattr_name, int name_len) | |||
| 424 | return len; | 424 | return len; |
| 425 | } | 425 | } |
| 426 | 426 | ||
| 427 | int hfsplus_setxattr(struct dentry *dentry, const char *name, | ||
| 428 | const void *value, size_t size, int flags, | ||
| 429 | const char *prefix, size_t prefixlen) | ||
| 430 | { | ||
| 431 | char *xattr_name; | ||
| 432 | int res; | ||
| 433 | |||
| 434 | if (!strcmp(name, "")) | ||
| 435 | return -EINVAL; | ||
| 436 | |||
| 437 | xattr_name = kmalloc(NLS_MAX_CHARSET_SIZE * HFSPLUS_ATTR_MAX_STRLEN + 1, | ||
| 438 | GFP_KERNEL); | ||
| 439 | if (!xattr_name) | ||
| 440 | return -ENOMEM; | ||
| 441 | strcpy(xattr_name, prefix); | ||
| 442 | strcpy(xattr_name + prefixlen, name); | ||
| 443 | res = __hfsplus_setxattr(dentry->d_inode, xattr_name, value, size, | ||
| 444 | flags); | ||
| 445 | kfree(xattr_name); | ||
| 446 | return res; | ||
| 447 | } | ||
| 448 | |||
| 427 | static ssize_t hfsplus_getxattr_finder_info(struct inode *inode, | 449 | static ssize_t hfsplus_getxattr_finder_info(struct inode *inode, |
| 428 | void *value, size_t size) | 450 | void *value, size_t size) |
| 429 | { | 451 | { |
| @@ -560,6 +582,30 @@ failed_getxattr_init: | |||
| 560 | return res; | 582 | return res; |
| 561 | } | 583 | } |
| 562 | 584 | ||
| 585 | ssize_t hfsplus_getxattr(struct dentry *dentry, const char *name, | ||
| 586 | void *value, size_t size, | ||
| 587 | const char *prefix, size_t prefixlen) | ||
| 588 | { | ||
| 589 | int res; | ||
| 590 | char *xattr_name; | ||
| 591 | |||
| 592 | if (!strcmp(name, "")) | ||
| 593 | return -EINVAL; | ||
| 594 | |||
| 595 | xattr_name = kmalloc(NLS_MAX_CHARSET_SIZE * HFSPLUS_ATTR_MAX_STRLEN + 1, | ||
| 596 | GFP_KERNEL); | ||
| 597 | if (!xattr_name) | ||
| 598 | return -ENOMEM; | ||
| 599 | |||
| 600 | strcpy(xattr_name, prefix); | ||
| 601 | strcpy(xattr_name + prefixlen, name); | ||
| 602 | |||
| 603 | res = __hfsplus_getxattr(dentry->d_inode, xattr_name, value, size); | ||
| 604 | kfree(xattr_name); | ||
| 605 | return res; | ||
| 606 | |||
| 607 | } | ||
| 608 | |||
| 563 | static inline int can_list(const char *xattr_name) | 609 | static inline int can_list(const char *xattr_name) |
| 564 | { | 610 | { |
| 565 | if (!xattr_name) | 611 | if (!xattr_name) |
| @@ -806,9 +852,6 @@ end_removexattr: | |||
| 806 | static int hfsplus_osx_getxattr(struct dentry *dentry, const char *name, | 852 | static int hfsplus_osx_getxattr(struct dentry *dentry, const char *name, |
| 807 | void *buffer, size_t size, int type) | 853 | void *buffer, size_t size, int type) |
| 808 | { | 854 | { |
| 809 | char *xattr_name; | ||
| 810 | int res; | ||
| 811 | |||
| 812 | if (!strcmp(name, "")) | 855 | if (!strcmp(name, "")) |
| 813 | return -EINVAL; | 856 | return -EINVAL; |
| 814 | 857 | ||
| @@ -818,24 +861,19 @@ static int hfsplus_osx_getxattr(struct dentry *dentry, const char *name, | |||
| 818 | */ | 861 | */ |
| 819 | if (is_known_namespace(name)) | 862 | if (is_known_namespace(name)) |
| 820 | return -EOPNOTSUPP; | 863 | return -EOPNOTSUPP; |
| 821 | xattr_name = kmalloc(NLS_MAX_CHARSET_SIZE * HFSPLUS_ATTR_MAX_STRLEN | ||
| 822 | + XATTR_MAC_OSX_PREFIX_LEN + 1, GFP_KERNEL); | ||
| 823 | if (!xattr_name) | ||
| 824 | return -ENOMEM; | ||
| 825 | strcpy(xattr_name, XATTR_MAC_OSX_PREFIX); | ||
| 826 | strcpy(xattr_name + XATTR_MAC_OSX_PREFIX_LEN, name); | ||
| 827 | 864 | ||
| 828 | res = hfsplus_getxattr(dentry, xattr_name, buffer, size); | 865 | /* |
| 829 | kfree(xattr_name); | 866 | * osx is the namespace we use to indicate an unprefixed |
| 830 | return res; | 867 | * attribute on the filesystem (like the ones that OS X |
| 868 | * creates), so we pass the name through unmodified (after | ||
| 869 | * ensuring it doesn't conflict with another namespace). | ||
| 870 | */ | ||
| 871 | return __hfsplus_getxattr(dentry->d_inode, name, buffer, size); | ||
| 831 | } | 872 | } |
| 832 | 873 | ||
| 833 | static int hfsplus_osx_setxattr(struct dentry *dentry, const char *name, | 874 | static int hfsplus_osx_setxattr(struct dentry *dentry, const char *name, |
| 834 | const void *buffer, size_t size, int flags, int type) | 875 | const void *buffer, size_t size, int flags, int type) |
| 835 | { | 876 | { |
| 836 | char *xattr_name; | ||
| 837 | int res; | ||
| 838 | |||
| 839 | if (!strcmp(name, "")) | 877 | if (!strcmp(name, "")) |
| 840 | return -EINVAL; | 878 | return -EINVAL; |
| 841 | 879 | ||
| @@ -845,16 +883,14 @@ static int hfsplus_osx_setxattr(struct dentry *dentry, const char *name, | |||
| 845 | */ | 883 | */ |
| 846 | if (is_known_namespace(name)) | 884 | if (is_known_namespace(name)) |
| 847 | return -EOPNOTSUPP; | 885 | return -EOPNOTSUPP; |
| 848 | xattr_name = kmalloc(NLS_MAX_CHARSET_SIZE * HFSPLUS_ATTR_MAX_STRLEN | ||
| 849 | + XATTR_MAC_OSX_PREFIX_LEN + 1, GFP_KERNEL); | ||
| 850 | if (!xattr_name) | ||
| 851 | return -ENOMEM; | ||
| 852 | strcpy(xattr_name, XATTR_MAC_OSX_PREFIX); | ||
| 853 | strcpy(xattr_name + XATTR_MAC_OSX_PREFIX_LEN, name); | ||
| 854 | 886 | ||
| 855 | res = hfsplus_setxattr(dentry, xattr_name, buffer, size, flags); | 887 | /* |
| 856 | kfree(xattr_name); | 888 | * osx is the namespace we use to indicate an unprefixed |
| 857 | return res; | 889 | * attribute on the filesystem (like the ones that OS X |
| 890 | * creates), so we pass the name through unmodified (after | ||
| 891 | * ensuring it doesn't conflict with another namespace). | ||
| 892 | */ | ||
| 893 | return __hfsplus_setxattr(dentry->d_inode, name, buffer, size, flags); | ||
| 858 | } | 894 | } |
| 859 | 895 | ||
| 860 | static size_t hfsplus_osx_listxattr(struct dentry *dentry, char *list, | 896 | static size_t hfsplus_osx_listxattr(struct dentry *dentry, char *list, |
diff --git a/fs/hfsplus/xattr.h b/fs/hfsplus/xattr.h index 288530cf80b5..f9b0955b3d28 100644 --- a/fs/hfsplus/xattr.h +++ b/fs/hfsplus/xattr.h | |||
| @@ -21,22 +21,16 @@ extern const struct xattr_handler *hfsplus_xattr_handlers[]; | |||
| 21 | int __hfsplus_setxattr(struct inode *inode, const char *name, | 21 | int __hfsplus_setxattr(struct inode *inode, const char *name, |
| 22 | const void *value, size_t size, int flags); | 22 | const void *value, size_t size, int flags); |
| 23 | 23 | ||
| 24 | static inline int hfsplus_setxattr(struct dentry *dentry, const char *name, | 24 | int hfsplus_setxattr(struct dentry *dentry, const char *name, |
| 25 | const void *value, size_t size, int flags) | 25 | const void *value, size_t size, int flags, |
| 26 | { | 26 | const char *prefix, size_t prefixlen); |
| 27 | return __hfsplus_setxattr(dentry->d_inode, name, value, size, flags); | ||
| 28 | } | ||
| 29 | 27 | ||
| 30 | ssize_t __hfsplus_getxattr(struct inode *inode, const char *name, | 28 | ssize_t __hfsplus_getxattr(struct inode *inode, const char *name, |
| 31 | void *value, size_t size); | 29 | void *value, size_t size); |
| 32 | 30 | ||
| 33 | static inline ssize_t hfsplus_getxattr(struct dentry *dentry, | 31 | ssize_t hfsplus_getxattr(struct dentry *dentry, const char *name, |
| 34 | const char *name, | 32 | void *value, size_t size, |
| 35 | void *value, | 33 | const char *prefix, size_t prefixlen); |
| 36 | size_t size) | ||
| 37 | { | ||
| 38 | return __hfsplus_getxattr(dentry->d_inode, name, value, size); | ||
| 39 | } | ||
| 40 | 34 | ||
| 41 | ssize_t hfsplus_listxattr(struct dentry *dentry, char *buffer, size_t size); | 35 | ssize_t hfsplus_listxattr(struct dentry *dentry, char *buffer, size_t size); |
| 42 | 36 | ||
diff --git a/fs/hfsplus/xattr_security.c b/fs/hfsplus/xattr_security.c index 6ec5e107691f..aacff00a9ff9 100644 --- a/fs/hfsplus/xattr_security.c +++ b/fs/hfsplus/xattr_security.c | |||
| @@ -16,43 +16,17 @@ | |||
| 16 | static int hfsplus_security_getxattr(struct dentry *dentry, const char *name, | 16 | static int hfsplus_security_getxattr(struct dentry *dentry, const char *name, |
| 17 | void *buffer, size_t size, int type) | 17 | void *buffer, size_t size, int type) |
| 18 | { | 18 | { |
| 19 | char *xattr_name; | 19 | return hfsplus_getxattr(dentry, name, buffer, size, |
| 20 | int res; | 20 | XATTR_SECURITY_PREFIX, |
| 21 | 21 | XATTR_SECURITY_PREFIX_LEN); | |
| 22 | if (!strcmp(name, "")) | ||
| 23 | return -EINVAL; | ||
| 24 | |||
| 25 | xattr_name = kmalloc(NLS_MAX_CHARSET_SIZE * HFSPLUS_ATTR_MAX_STRLEN + 1, | ||
| 26 | GFP_KERNEL); | ||
| 27 | if (!xattr_name) | ||
| 28 | return -ENOMEM; | ||
| 29 | strcpy(xattr_name, XATTR_SECURITY_PREFIX); | ||
| 30 | strcpy(xattr_name + XATTR_SECURITY_PREFIX_LEN, name); | ||
| 31 | |||
| 32 | res = hfsplus_getxattr(dentry, xattr_name, buffer, size); | ||
| 33 | kfree(xattr_name); | ||
| 34 | return res; | ||
| 35 | } | 22 | } |
| 36 | 23 | ||
| 37 | static int hfsplus_security_setxattr(struct dentry *dentry, const char *name, | 24 | static int hfsplus_security_setxattr(struct dentry *dentry, const char *name, |
| 38 | const void *buffer, size_t size, int flags, int type) | 25 | const void *buffer, size_t size, int flags, int type) |
| 39 | { | 26 | { |
| 40 | char *xattr_name; | 27 | return hfsplus_setxattr(dentry, name, buffer, size, flags, |
| 41 | int res; | 28 | XATTR_SECURITY_PREFIX, |
| 42 | 29 | XATTR_SECURITY_PREFIX_LEN); | |
| 43 | if (!strcmp(name, "")) | ||
| 44 | return -EINVAL; | ||
| 45 | |||
| 46 | xattr_name = kmalloc(NLS_MAX_CHARSET_SIZE * HFSPLUS_ATTR_MAX_STRLEN + 1, | ||
| 47 | GFP_KERNEL); | ||
| 48 | if (!xattr_name) | ||
| 49 | return -ENOMEM; | ||
| 50 | strcpy(xattr_name, XATTR_SECURITY_PREFIX); | ||
| 51 | strcpy(xattr_name + XATTR_SECURITY_PREFIX_LEN, name); | ||
| 52 | |||
| 53 | res = hfsplus_setxattr(dentry, xattr_name, buffer, size, flags); | ||
| 54 | kfree(xattr_name); | ||
| 55 | return res; | ||
| 56 | } | 30 | } |
| 57 | 31 | ||
| 58 | static size_t hfsplus_security_listxattr(struct dentry *dentry, char *list, | 32 | static size_t hfsplus_security_listxattr(struct dentry *dentry, char *list, |
diff --git a/fs/hfsplus/xattr_trusted.c b/fs/hfsplus/xattr_trusted.c index 3c5f27e4746a..bcf65089b7f7 100644 --- a/fs/hfsplus/xattr_trusted.c +++ b/fs/hfsplus/xattr_trusted.c | |||
| @@ -14,43 +14,16 @@ | |||
| 14 | static int hfsplus_trusted_getxattr(struct dentry *dentry, const char *name, | 14 | static int hfsplus_trusted_getxattr(struct dentry *dentry, const char *name, |
| 15 | void *buffer, size_t size, int type) | 15 | void *buffer, size_t size, int type) |
| 16 | { | 16 | { |
| 17 | char *xattr_name; | 17 | return hfsplus_getxattr(dentry, name, buffer, size, |
| 18 | int res; | 18 | XATTR_TRUSTED_PREFIX, |
| 19 | 19 | XATTR_TRUSTED_PREFIX_LEN); | |
| 20 | if (!strcmp(name, "")) | ||
| 21 | return -EINVAL; | ||
| 22 | |||
| 23 | xattr_name = kmalloc(NLS_MAX_CHARSET_SIZE * HFSPLUS_ATTR_MAX_STRLEN + 1, | ||
| 24 | GFP_KERNEL); | ||
| 25 | if (!xattr_name) | ||
| 26 | return -ENOMEM; | ||
| 27 | strcpy(xattr_name, XATTR_TRUSTED_PREFIX); | ||
| 28 | strcpy(xattr_name + XATTR_TRUSTED_PREFIX_LEN, name); | ||
| 29 | |||
| 30 | res = hfsplus_getxattr(dentry, xattr_name, buffer, size); | ||
| 31 | kfree(xattr_name); | ||
| 32 | return res; | ||
| 33 | } | 20 | } |
| 34 | 21 | ||
| 35 | static int hfsplus_trusted_setxattr(struct dentry *dentry, const char *name, | 22 | static int hfsplus_trusted_setxattr(struct dentry *dentry, const char *name, |
| 36 | const void *buffer, size_t size, int flags, int type) | 23 | const void *buffer, size_t size, int flags, int type) |
| 37 | { | 24 | { |
| 38 | char *xattr_name; | 25 | return hfsplus_setxattr(dentry, name, buffer, size, flags, |
| 39 | int res; | 26 | XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN); |
| 40 | |||
| 41 | if (!strcmp(name, "")) | ||
| 42 | return -EINVAL; | ||
| 43 | |||
| 44 | xattr_name = kmalloc(NLS_MAX_CHARSET_SIZE * HFSPLUS_ATTR_MAX_STRLEN + 1, | ||
| 45 | GFP_KERNEL); | ||
| 46 | if (!xattr_name) | ||
| 47 | return -ENOMEM; | ||
| 48 | strcpy(xattr_name, XATTR_TRUSTED_PREFIX); | ||
| 49 | strcpy(xattr_name + XATTR_TRUSTED_PREFIX_LEN, name); | ||
| 50 | |||
| 51 | res = hfsplus_setxattr(dentry, xattr_name, buffer, size, flags); | ||
| 52 | kfree(xattr_name); | ||
| 53 | return res; | ||
| 54 | } | 27 | } |
| 55 | 28 | ||
| 56 | static size_t hfsplus_trusted_listxattr(struct dentry *dentry, char *list, | 29 | static size_t hfsplus_trusted_listxattr(struct dentry *dentry, char *list, |
diff --git a/fs/hfsplus/xattr_user.c b/fs/hfsplus/xattr_user.c index 2b625a538b64..5aa0e6dc4a1e 100644 --- a/fs/hfsplus/xattr_user.c +++ b/fs/hfsplus/xattr_user.c | |||
| @@ -14,43 +14,16 @@ | |||
| 14 | static int hfsplus_user_getxattr(struct dentry *dentry, const char *name, | 14 | static int hfsplus_user_getxattr(struct dentry *dentry, const char *name, |
| 15 | void *buffer, size_t size, int type) | 15 | void *buffer, size_t size, int type) |
| 16 | { | 16 | { |
| 17 | char *xattr_name; | ||
| 18 | int res; | ||
| 19 | 17 | ||
| 20 | if (!strcmp(name, "")) | 18 | return hfsplus_getxattr(dentry, name, buffer, size, |
| 21 | return -EINVAL; | 19 | XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN); |
| 22 | |||
| 23 | xattr_name = kmalloc(NLS_MAX_CHARSET_SIZE * HFSPLUS_ATTR_MAX_STRLEN + 1, | ||
| 24 | GFP_KERNEL); | ||
| 25 | if (!xattr_name) | ||
| 26 | return -ENOMEM; | ||
| 27 | strcpy(xattr_name, XATTR_USER_PREFIX); | ||
| 28 | strcpy(xattr_name + XATTR_USER_PREFIX_LEN, name); | ||
| 29 | |||
| 30 | res = hfsplus_getxattr(dentry, xattr_name, buffer, size); | ||
| 31 | kfree(xattr_name); | ||
| 32 | return res; | ||
| 33 | } | 20 | } |
| 34 | 21 | ||
| 35 | static int hfsplus_user_setxattr(struct dentry *dentry, const char *name, | 22 | static int hfsplus_user_setxattr(struct dentry *dentry, const char *name, |
| 36 | const void *buffer, size_t size, int flags, int type) | 23 | const void *buffer, size_t size, int flags, int type) |
| 37 | { | 24 | { |
| 38 | char *xattr_name; | 25 | return hfsplus_setxattr(dentry, name, buffer, size, flags, |
| 39 | int res; | 26 | XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN); |
| 40 | |||
| 41 | if (!strcmp(name, "")) | ||
| 42 | return -EINVAL; | ||
| 43 | |||
| 44 | xattr_name = kmalloc(NLS_MAX_CHARSET_SIZE * HFSPLUS_ATTR_MAX_STRLEN + 1, | ||
| 45 | GFP_KERNEL); | ||
| 46 | if (!xattr_name) | ||
| 47 | return -ENOMEM; | ||
| 48 | strcpy(xattr_name, XATTR_USER_PREFIX); | ||
| 49 | strcpy(xattr_name + XATTR_USER_PREFIX_LEN, name); | ||
| 50 | |||
| 51 | res = hfsplus_setxattr(dentry, xattr_name, buffer, size, flags); | ||
| 52 | kfree(xattr_name); | ||
| 53 | return res; | ||
| 54 | } | 27 | } |
| 55 | 28 | ||
| 56 | static size_t hfsplus_user_listxattr(struct dentry *dentry, char *list, | 29 | static size_t hfsplus_user_listxattr(struct dentry *dentry, char *list, |
