summaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs3xdr.c
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@hammerspace.com>2021-04-01 20:03:26 +0200
committerTrond Myklebust <trond.myklebust@hammerspace.com>2021-04-14 15:36:29 +0200
commiteb3d58c68e39fad68d8054e0324eb06d82dcedbb (patch)
treebebaae6d3ad6fad610fc1ac0e1662327f39ca823 /fs/nfs/nfs3xdr.c
parentNFSv4: Convert nfs_xdr_status tracepoint to an event class (diff)
downloadlinux-eb3d58c68e39fad68d8054e0324eb06d82dcedbb.tar.xz
linux-eb3d58c68e39fad68d8054e0324eb06d82dcedbb.zip
NFSv4: Catch and trace server filehandle encoding errors
If the server returns a filehandle with an invalid length, then trace that, and return an EREMOTEIO error. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Diffstat (limited to 'fs/nfs/nfs3xdr.c')
-rw-r--r--fs/nfs/nfs3xdr.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/nfs/nfs3xdr.c b/fs/nfs/nfs3xdr.c
index 83ad62c81fc7..e6eca1d7481b 100644
--- a/fs/nfs/nfs3xdr.c
+++ b/fs/nfs/nfs3xdr.c
@@ -433,7 +433,7 @@ static int decode_nfs_fh3(struct xdr_stream *xdr, struct nfs_fh *fh)
if (unlikely(!p))
return -EIO;
length = be32_to_cpup(p++);
- if (unlikely(length > NFS3_FHSIZE))
+ if (unlikely(length > NFS3_FHSIZE || length == 0))
goto out_toobig;
p = xdr_inline_decode(xdr, length);
if (unlikely(!p))
@@ -442,7 +442,7 @@ static int decode_nfs_fh3(struct xdr_stream *xdr, struct nfs_fh *fh)
memcpy(fh->data, p, length);
return 0;
out_toobig:
- dprintk("NFS: file handle size (%u) too big\n", length);
+ trace_nfs_xdr_bad_filehandle(xdr, NFSERR_BADHANDLE);
return -E2BIG;
}