Skip to content

Commit 92724d5

Browse files
dhowellssmb49
authored andcommitted
afs: Stop listxattr() from listing "afs.*" attributes
BugLink: https://bugs.launchpad.net/bugs/1923214 commit a7889c6 upstream. afs_listxattr() lists all the available special afs xattrs (i.e. those in the "afs.*" space), no matter what type of server we're dealing with. But OpenAFS servers, for example, cannot deal with some of the extra-capable attributes that AuriStor (YFS) servers provide. Unfortunately, the presence of the afs.yfs.* attributes causes errors[1] for anything that tries to read them if the server is of the wrong type. Fix the problem by removing afs_listxattr() so that none of the special xattrs are listed (AFS doesn't support xattrs). It does mean, however, that getfattr won't list them, though they can still be accessed with getxattr() and setxattr(). This can be tested with something like: getfattr -d -m ".*" /afs/example.com/path/to/file With this change, none of the afs.* attributes should be visible. Changes: ver #2: - Hide all of the afs.* xattrs, not just the ACL ones. Fixes: ae46578 ("afs: Get YFS ACLs and information through xattrs") Reported-by: Gaja Sophie Peters <[email protected]> Signed-off-by: David Howells <[email protected]> Tested-by: Gaja Sophie Peters <[email protected]> Reviewed-by: Jeffrey Altman <[email protected]> Reviewed-by: Marc Dionne <[email protected]> cc: [email protected] Link: http://lists.infradead.org/pipermail/linux-afs/2021-March/003502.html [1] Link: http://lists.infradead.org/pipermail/linux-afs/2021-March/003567.html # v1 Link: http://lists.infradead.org/pipermail/linux-afs/2021-March/003573.html # v2 Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Kamal Mostafa <[email protected]> Signed-off-by: Stefan Bader <[email protected]>
1 parent a5c7112 commit 92724d5

File tree

6 files changed

+0
-28
lines changed

6 files changed

+0
-28
lines changed

fs/afs/dir.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ const struct inode_operations afs_dir_inode_operations = {
6969
.permission = afs_permission,
7070
.getattr = afs_getattr,
7171
.setattr = afs_setattr,
72-
.listxattr = afs_listxattr,
7372
};
7473

7574
const struct address_space_operations afs_dir_aops = {

fs/afs/file.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ const struct inode_operations afs_file_inode_operations = {
4242
.getattr = afs_getattr,
4343
.setattr = afs_setattr,
4444
.permission = afs_permission,
45-
.listxattr = afs_listxattr,
4645
};
4746

4847
const struct address_space_operations afs_fs_aops = {

fs/afs/inode.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727

2828
static const struct inode_operations afs_symlink_inode_operations = {
2929
.get_link = page_get_link,
30-
.listxattr = afs_listxattr,
3130
};
3231

3332
static noinline void dump_vnode(struct afs_vnode *vnode, struct afs_vnode *parent_vnode)

fs/afs/internal.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1354,7 +1354,6 @@ extern int afs_launder_page(struct page *);
13541354
* xattr.c
13551355
*/
13561356
extern const struct xattr_handler *afs_xattr_handlers[];
1357-
extern ssize_t afs_listxattr(struct dentry *, char *, size_t);
13581357

13591358
/*
13601359
* yfsclient.c

fs/afs/mntpt.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ const struct inode_operations afs_mntpt_inode_operations = {
3232
.lookup = afs_mntpt_lookup,
3333
.readlink = page_readlink,
3434
.getattr = afs_getattr,
35-
.listxattr = afs_listxattr,
3635
};
3736

3837
const struct inode_operations afs_autocell_inode_operations = {

fs/afs/xattr.c

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,6 @@
1111
#include <linux/xattr.h>
1212
#include "internal.h"
1313

14-
static const char afs_xattr_list[] =
15-
"afs.acl\0"
16-
"afs.cell\0"
17-
"afs.fid\0"
18-
"afs.volume\0"
19-
"afs.yfs.acl\0"
20-
"afs.yfs.acl_inherited\0"
21-
"afs.yfs.acl_num_cleaned\0"
22-
"afs.yfs.vol_acl";
23-
24-
/*
25-
* Retrieve a list of the supported xattrs.
26-
*/
27-
ssize_t afs_listxattr(struct dentry *dentry, char *buffer, size_t size)
28-
{
29-
if (size == 0)
30-
return sizeof(afs_xattr_list);
31-
if (size < sizeof(afs_xattr_list))
32-
return -ERANGE;
33-
memcpy(buffer, afs_xattr_list, sizeof(afs_xattr_list));
34-
return sizeof(afs_xattr_list);
35-
}
36-
3714
/*
3815
* Get a file's ACL.
3916
*/

0 commit comments

Comments
 (0)