NFS: NFSv2/v3 clients should never be setting NFS_CAP_XATTR
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Tue, 22 Feb 2022 23:20:38 +0000 (18:20 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 Apr 2022 12:22:52 +0000 (14:22 +0200)
commit b622ffe1d9ecbac71f0cddb52ff0831efdf8fb83 upstream.

Ensure that we always initialise the 'xattr_support' field in struct
nfs_fsinfo, so that nfs_server_set_fsinfo() doesn't declare our NFSv2/v3
client to be capable of supporting the NFSv4.2 xattr protocol by setting
the NFS_CAP_XATTR capability.

This configuration can cause nfs_do_access() to set access mode bits
that are unsupported by the NFSv3 ACCESS call, which may confuse
spec-compliant servers.

Reported-by: Olga Kornievskaia <kolga@netapp.com>
Fixes: b78ef845c35d ("NFSv4.2: query the server for extended attribute support")
Cc: stable@vger.kernel.org
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/nfs/nfs3xdr.c
fs/nfs/proc.c

index 9274c9c5efea63e073acf0c5cff2b744a124a944..54a1d21cbcc65d8500cc2e62a396dc14b0ced295 100644 (file)
@@ -2228,6 +2228,7 @@ static int decode_fsinfo3resok(struct xdr_stream *xdr,
        /* ignore properties */
        result->lease_time = 0;
        result->change_attr_type = NFS4_CHANGE_TYPE_IS_UNDEFINED;
+       result->xattr_support = 0;
        return 0;
 }
 
index ecc4e717808c4ee5958b30d1b5f513c260a427df..a5b0bdcb5396347542295d35f30706de53fb8ea6 100644 (file)
@@ -92,6 +92,7 @@ nfs_proc_get_root(struct nfs_server *server, struct nfs_fh *fhandle,
        info->maxfilesize = 0x7FFFFFFF;
        info->lease_time = 0;
        info->change_attr_type = NFS4_CHANGE_TYPE_IS_UNDEFINED;
+       info->xattr_support = 0;
        return 0;
 }