Skip to content

Commit a7889c6

Browse files
committed
afs: Stop listxattr() from listing "afs.*" attributes
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 <gaja.peters@math.uni-hamburg.de> Signed-off-by: David Howells <dhowells@redhat.com> Tested-by: Gaja Sophie Peters <gaja.peters@math.uni-hamburg.de> Reviewed-by: Jeffrey Altman <jaltman@auristor.com> Reviewed-by: Marc Dionne <marc.dionne@auristor.com> cc: linux-afs@lists.infradead.org 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
1 parent 64fcbb6 commit a7889c6

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
@@ -70,7 +70,6 @@ const struct inode_operations afs_dir_inode_operations = {
7070
.permission = afs_permission,
7171
.getattr = afs_getattr,
7272
.setattr = afs_setattr,
73-
.listxattr = afs_listxattr,
7473
};
7574

7675
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
@@ -43,7 +43,6 @@ const struct inode_operations afs_file_inode_operations = {
4343
.getattr = afs_getattr,
4444
.setattr = afs_setattr,
4545
.permission = afs_permission,
46-
.listxattr = afs_listxattr,
4746
};
4847

4948
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
@@ -1509,7 +1509,6 @@ extern int afs_launder_page(struct page *);
15091509
* xattr.c
15101510
*/
15111511
extern const struct xattr_handler *afs_xattr_handlers[];
1512-
extern ssize_t afs_listxattr(struct dentry *, char *, size_t);
15131512

15141513
/*
15151514
* 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
* Deal with the result of a successful fetch ACL operation.
3916
*/

0 commit comments

Comments
 (0)