NFSv4 remove zero number of fs_locations entries error check
authorOlga Kornievskaia <kolga@netapp.com>
Thu, 9 Dec 2021 19:53:29 +0000 (14:53 -0500)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Wed, 12 Jan 2022 19:26:05 +0000 (14:26 -0500)
Remove the check for the zero length fs_locations reply in the
xdr decoding, and instead check for that in the migration code.

Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
fs/nfs/nfs4state.c
fs/nfs/nfs4xdr.c

index f63dfa0..f326557 100644 (file)
@@ -2106,6 +2106,9 @@ static int nfs4_try_migration(struct nfs_server *server, const struct cred *cred
        }
 
        result = -NFS4ERR_NXIO;
+       if (!locations->nlocations)
+               goto out;
+
        if (!(locations->fattr.valid & NFS_ATTR_FATTR_V4_LOCATIONS)) {
                dprintk("<-- %s: No fs_locations data, migration skipped\n",
                        __func__);
index a9487c8..8e70b92 100644 (file)
@@ -3732,8 +3732,6 @@ static int decode_attr_fs_locations(struct xdr_stream *xdr, uint32_t *bitmap, st
        if (unlikely(!p))
                goto out_eio;
        n = be32_to_cpup(p);
-       if (n <= 0)
-               goto out_eio;
        for (res->nlocations = 0; res->nlocations < n; res->nlocations++) {
                u32 m;
                struct nfs4_fs_location *loc;