NFS: don't try to decode GETATTR if DELEGRETURN returned error
Subsystems (2)
PATCH 1/1 NFS: don't try to decode GETATTR if DELEGRETURN returned error
The reply parsing code attempts to decode the GETATTR response even if the DELEGRETURN portion of the compound returned an error. The GETATTR response won't actually exist if that's the case and we're asking the parser to read past the end of the response.
This bug is fairly benign. The parser catches this without reading past the end of the response and decode_getfattr returns -EIO. Earlier kernels however had decode_op_hdr using the READ_BUF macro, and this bug would make this printk pop any time the client got an error from a delegreturn:
kernel: decode_op_hdr: reply buffer overflowed in line XXXX
More recent kernels seem to have replaced this printk with a dprintk.
--- fs/nfs/nfs4xdr.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
fs/nfs/nfs4xdr.c +2 -0
@@ -5552,6 +5552,8 @@ static int nfs4_xdr_dec_delegreturn(struct rpc_rqst *rqstp, __be32 *p, struct nfif (status !=0 ) goto out; status =decode_delegreturn (&xdr); +if (status !=0 ) + goto out;decode_getfattr (&xdr, res->fattr, res->server, !RPC_IS_ASYNC (rqstp->rq_task)); out:
Signature · 1 line
1.6.6.1
Trond Myklebust
AppliedQuoted 11 lines · Jeff Layton
The reply parsing code attempts to decode the GETATTR response even if the DELEGRETURN portion of the compound returned an error. The GETATTR response won't actually exist if that's the case and we're asking the parser to read past the end of the response.
This bug is fairly benign. The parser catches this without reading past the end of the response and
decode_getfattrreturns-EIO. Earlier kernels however haddecode_op_hdrusing theREAD_BUFmacro, and this bug would make this printk pop any time the client got an error from a delegreturn:
Quoted 5 lines
kernel:
decode_op_hdr: reply buffer overflowed in line XXXXMore recent kernels seem to have replaced this printk with a dprintk.
Signed-off-by Jeff Layton <[email protected]>
Applied. Thanks!
Trond