lkml.org 
[lkml]   [2024]   [Feb]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Date
    Subject[PATCH v2 25/25] vfs: return -EOPNOTSUPP for fscaps from vfs_*xattr()
    Now that the new vfs-level interfaces are fully supported and all code
    has been converted to use them, stop permitting use of the top-level vfs
    xattr interfaces for capabilities xattrs. Unlike with ACLs we still need
    to be able to work with fscaps xattrs using lower-level interfaces in a
    handful of places, so only use of the top-level xattr interfaces is
    restricted.

    Signed-off-by: Seth Forshee (DigitalOcean) <sforshee@kernel.org>
    ---
    fs/xattr.c | 9 +++++++++
    1 file changed, 9 insertions(+)

    diff --git a/fs/xattr.c b/fs/xattr.c
    index 30eff6bc4f6d..2b8214c9534f 100644
    --- a/fs/xattr.c
    +++ b/fs/xattr.c
    @@ -534,6 +534,9 @@ vfs_setxattr(struct mnt_idmap *idmap, struct dentry *dentry,
    const void *orig_value = value;
    int error;

    + if (WARN_ON_ONCE(is_fscaps_xattr(name)))
    + return -EOPNOTSUPP;
    +
    retry_deleg:
    inode_lock(inode);
    error = __vfs_setxattr_locked(idmap, dentry, name, value, size,
    @@ -649,6 +652,9 @@ vfs_getxattr(struct mnt_idmap *idmap, struct dentry *dentry,
    struct inode *inode = dentry->d_inode;
    int error;

    + if (WARN_ON_ONCE(is_fscaps_xattr(name)))
    + return -EOPNOTSUPP;
    +
    error = xattr_permission(idmap, inode, name, MAY_READ);
    if (error)
    return error;
    @@ -788,6 +794,9 @@ vfs_removexattr(struct mnt_idmap *idmap, struct dentry *dentry,
    struct inode *delegated_inode = NULL;
    int error;

    + if (WARN_ON_ONCE(is_fscaps_xattr(name)))
    + return -EOPNOTSUPP;
    +
    retry_deleg:
    inode_lock(inode);
    error = __vfs_removexattr_locked(idmap, dentry,
    --
    2.43.0


    \
     
     \ /
      Last update: 2024-05-27 15:15    [W:4.430 / U:0.020 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site