Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

new helpers: file_listxattr(), filename_listxattr()

switch path_listxattr() and flistxattr(2) to those

Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro 60ad149c 0158005a

+24 -6
+24 -6
fs/xattr.c
··· 888 888 return error; 889 889 } 890 890 891 - static ssize_t path_listxattr(const char __user *pathname, char __user *list, 892 - size_t size, unsigned int lookup_flags) 891 + static 892 + ssize_t file_listxattr(struct file *f, char __user *list, size_t size) 893 + { 894 + audit_file(f); 895 + return listxattr(f->f_path.dentry, list, size); 896 + } 897 + 898 + /* unconditionally consumes filename */ 899 + static 900 + ssize_t filename_listxattr(int dfd, struct filename *filename, 901 + unsigned int lookup_flags, 902 + char __user *list, size_t size) 893 903 { 894 904 struct path path; 895 905 ssize_t error; 896 906 retry: 897 - error = user_path_at(AT_FDCWD, pathname, lookup_flags, &path); 907 + error = filename_lookup(dfd, filename, lookup_flags, &path, NULL); 898 908 if (error) 899 - return error; 909 + goto out; 900 910 error = listxattr(path.dentry, list, size); 901 911 path_put(&path); 902 912 if (retry_estale(error, lookup_flags)) { 903 913 lookup_flags |= LOOKUP_REVAL; 904 914 goto retry; 905 915 } 916 + out: 917 + putname(filename); 906 918 return error; 919 + } 920 + 921 + static ssize_t path_listxattr(const char __user *pathname, char __user *list, 922 + size_t size, unsigned int lookup_flags) 923 + { 924 + return filename_listxattr(AT_FDCWD, getname(pathname), lookup_flags, 925 + list, size); 907 926 } 908 927 909 928 SYSCALL_DEFINE3(listxattr, const char __user *, pathname, char __user *, list, ··· 943 924 944 925 if (fd_empty(f)) 945 926 return -EBADF; 946 - audit_file(fd_file(f)); 947 - return listxattr(fd_file(f)->f_path.dentry, list, size); 927 + return file_listxattr(fd_file(f), list, size); 948 928 } 949 929 950 930 /*