AFS fixes

-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEqG5UsNXhtOCrfGQP+7dXa6fLC2sFAmBPlQAACgkQ+7dXa6fL
 C2sfvg/+OQ4aI7aqh8HahAjxLYaRShaKHQAxnjiyL8o7BELYr5PngH7cLyBw+mt8
 WsymoT1dSSl+n8X/bsYRwP+FsL/jsF6PgjerVkSs9Z131lwKqaAaAE6dx1pGL1fj
 7I7uqogytaEUJPe1fD4TDk3i1oozm3MuYfXUu1Gi8sm1mnsfUaWndROYSuqwAs1O
 TatZa0vCdAsBhC3zgE/K1hA7/tZMXLsh+6FwUqkztOcKg7P44yAfuxMZZ5SNs2FG
 fE5N8YQRpSZwg/RxCsZnH3Zi0jIonVr1OKG56LXTKzW96eEZd4TP2YqZGD/LhQOU
 lPkp1LlqhH9meelRP9x7iaDXeIGRTPjlI/Te+xnOIyCQV9gMHgCwOrODaLf5/QJa
 JQpL8nsxCAQb3yAIvmojjld4D2j9e/adickbwZZHdBV8EkXMEeL1d+5eEEDcgOmN
 RQmubY/79KDXHcgmUBcoNu+8Q/MYcboc+ZBwtgZ4B116KpjvGo7s/scUHsSpwgG9
 kR55gx73xoYAzmViRB7uLPUQXkQYHkDZgV42f1Sx1qXucTFMmppYMPfkTuIQcxkb
 zKexFcIq7WZ6OuBHZdAlqW82wpA7/QWscy4y9jMukiX9L0MHliW5v1BH1rHOxe6W
 agFp/O+u920ebymq9NnJvzD02Wyu1nPFslXpQ+vZJ3cEig8pmEg=
 =0TI9
 -----END PGP SIGNATURE-----

Merge tag 'afs-fixes-20210315' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs

Pull AFS fixes from David Howells:

 - Fix an oops in AFS that can be triggered by accessing one of the
   afs.yfs.* xattrs against an OpenAFS server - for instance by commands
   like "cp -a"[1], "rsync -X" or getfattr[2]. These try and copy all of
   the xattrs.

   cp and rsync should pay attention to the list in /etc/xattr.conf, but
   cp doesn't on Ubuntu and rsync doesn't seem to on Ubuntu or Fedora.
   xattr.conf has been modified upstream[3], and a new version has just
   been cut that includes it. I've logged a bug against rsync for the
   problem there[4].

 - Stop listing "afs.*" xattrs[5][6][7], but particularly ACL ones[8] so
   that they don't confuse cp and rsync.

   This removes them from the list returned by listxattr(), but they're
   still available to get/set.

Link: http://lists.infradead.org/pipermail/linux-afs/2021-March/003498.html [1]
Link: http://lists.infradead.org/pipermail/linux-afs/2021-March/003501.html [2]
Link: https://git.savannah.nongnu.org/cgit/attr.git/commit/?id=74da517cc655a82ded715dea7245ce88ebc91b98 [3]
Link: https://github.com/WayneD/rsync/issues/163 [4]
Link: http://lists.infradead.org/pipermail/linux-afs/2021-March/003516.html [5]
Link: http://lists.infradead.org/pipermail/linux-afs/2021-March/003524.html [6]
Link: http://lists.infradead.org/pipermail/linux-afs/2021-March/003565.html # v1
Link: http://lists.infradead.org/pipermail/linux-afs/2021-March/003568.html [7]
Link: http://lists.infradead.org/pipermail/linux-afs/2021-March/003570.html [8]
Link: http://lists.infradead.org/pipermail/linux-afs/2021-March/003571.html # v2

* tag 'afs-fixes-20210315' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs:
  afs: Stop listxattr() from listing "afs.*" attributes
  afs: Fix accessing YFS xattrs on a non-YFS server
This commit is contained in:
Linus Torvalds 2021-03-15 16:36:40 -07:00
commit 1a4431a5db
7 changed files with 12 additions and 31 deletions

View file

@ -70,7 +70,6 @@ const struct inode_operations afs_dir_inode_operations = {
.permission = afs_permission,
.getattr = afs_getattr,
.setattr = afs_setattr,
.listxattr = afs_listxattr,
};
const struct address_space_operations afs_dir_aops = {

View file

@ -43,7 +43,6 @@ const struct inode_operations afs_file_inode_operations = {
.getattr = afs_getattr,
.setattr = afs_setattr,
.permission = afs_permission,
.listxattr = afs_listxattr,
};
const struct address_space_operations afs_fs_aops = {

View file

@ -181,10 +181,13 @@ void afs_wait_for_operation(struct afs_operation *op)
if (test_bit(AFS_SERVER_FL_IS_YFS, &op->server->flags) &&
op->ops->issue_yfs_rpc)
op->ops->issue_yfs_rpc(op);
else
else if (op->ops->issue_afs_rpc)
op->ops->issue_afs_rpc(op);
else
op->ac.error = -ENOTSUPP;
op->error = afs_wait_for_call_to_complete(op->call, &op->ac);
if (op->call)
op->error = afs_wait_for_call_to_complete(op->call, &op->ac);
}
switch (op->error) {

View file

@ -27,7 +27,6 @@
static const struct inode_operations afs_symlink_inode_operations = {
.get_link = page_get_link,
.listxattr = afs_listxattr,
};
static noinline void dump_vnode(struct afs_vnode *vnode, struct afs_vnode *parent_vnode)

View file

@ -1509,7 +1509,6 @@ extern int afs_launder_page(struct page *);
* xattr.c
*/
extern const struct xattr_handler *afs_xattr_handlers[];
extern ssize_t afs_listxattr(struct dentry *, char *, size_t);
/*
* yfsclient.c

View file

@ -32,7 +32,6 @@ const struct inode_operations afs_mntpt_inode_operations = {
.lookup = afs_mntpt_lookup,
.readlink = page_readlink,
.getattr = afs_getattr,
.listxattr = afs_listxattr,
};
const struct inode_operations afs_autocell_inode_operations = {

View file

@ -11,29 +11,6 @@
#include <linux/xattr.h>
#include "internal.h"
static const char afs_xattr_list[] =
"afs.acl\0"
"afs.cell\0"
"afs.fid\0"
"afs.volume\0"
"afs.yfs.acl\0"
"afs.yfs.acl_inherited\0"
"afs.yfs.acl_num_cleaned\0"
"afs.yfs.vol_acl";
/*
* Retrieve a list of the supported xattrs.
*/
ssize_t afs_listxattr(struct dentry *dentry, char *buffer, size_t size)
{
if (size == 0)
return sizeof(afs_xattr_list);
if (size < sizeof(afs_xattr_list))
return -ERANGE;
memcpy(buffer, afs_xattr_list, sizeof(afs_xattr_list));
return sizeof(afs_xattr_list);
}
/*
* Deal with the result of a successful fetch ACL operation.
*/
@ -231,6 +208,8 @@ static int afs_xattr_get_yfs(const struct xattr_handler *handler,
else
ret = -ERANGE;
}
} else if (ret == -ENOTSUPP) {
ret = -ENODATA;
}
error_yacl:
@ -256,6 +235,7 @@ static int afs_xattr_set_yfs(const struct xattr_handler *handler,
{
struct afs_operation *op;
struct afs_vnode *vnode = AFS_FS_I(inode);
int ret;
if (flags == XATTR_CREATE ||
strcmp(name, "acl") != 0)
@ -270,7 +250,10 @@ static int afs_xattr_set_yfs(const struct xattr_handler *handler,
return afs_put_operation(op);
op->ops = &yfs_store_opaque_acl2_operation;
return afs_do_sync_operation(op);
ret = afs_do_sync_operation(op);
if (ret == -ENOTSUPP)
ret = -ENODATA;
return ret;
}
static const struct xattr_handler afs_xattr_yfs_handler = {