Skip to content

Commit 8ce35dc

Browse files
committed
NFSD: Fix callback decoder status codes
fs/nfsd/nfs4callback.c implements a callback client. Thus its XDR decoders are decoding replies, not calls. NFS4ERR_BAD_XDR is an on-the-wire status code that reports that the client sent a corrupted RPC /call/. It's not used as the internal error code when a /reply/ can't be decoded, since that kind of failure is never reported to the sender of that RPC message. Instead, a reply decoder should return -EIO, as the reply decoders in the NFS client do. Fixes: 6487a13 ("NFSD: add support for CB_GETATTR callback") Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
1 parent 4b54b85 commit 8ce35dc

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

fs/nfsd/nfs4callback.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,15 @@ static int decode_cb_fattr4(struct xdr_stream *xdr, uint32_t *bitmap,
101101

102102
if (bitmap[0] & FATTR4_WORD0_CHANGE)
103103
if (xdr_stream_decode_u64(xdr, &fattr->ncf_cb_change) < 0)
104-
return -NFSERR_BAD_XDR;
104+
return -EIO;
105105
if (bitmap[0] & FATTR4_WORD0_SIZE)
106106
if (xdr_stream_decode_u64(xdr, &fattr->ncf_cb_fsize) < 0)
107-
return -NFSERR_BAD_XDR;
107+
return -EIO;
108108
if (bitmap[2] & FATTR4_WORD2_TIME_DELEG_ACCESS) {
109109
fattr4_time_deleg_access access;
110110

111111
if (!xdrgen_decode_fattr4_time_deleg_access(xdr, &access))
112-
return -NFSERR_BAD_XDR;
112+
return -EIO;
113113
fattr->ncf_cb_atime.tv_sec = access.seconds;
114114
fattr->ncf_cb_atime.tv_nsec = access.nseconds;
115115

@@ -118,7 +118,7 @@ static int decode_cb_fattr4(struct xdr_stream *xdr, uint32_t *bitmap,
118118
fattr4_time_deleg_modify modify;
119119

120120
if (!xdrgen_decode_fattr4_time_deleg_modify(xdr, &modify))
121-
return -NFSERR_BAD_XDR;
121+
return -EIO;
122122
fattr->ncf_cb_mtime.tv_sec = modify.seconds;
123123
fattr->ncf_cb_mtime.tv_nsec = modify.nseconds;
124124

@@ -682,15 +682,15 @@ static int nfs4_xdr_dec_cb_getattr(struct rpc_rqst *rqstp,
682682
if (unlikely(status || cb->cb_status))
683683
return status;
684684
if (xdr_stream_decode_uint32_array(xdr, bitmap, 3) < 0)
685-
return -NFSERR_BAD_XDR;
685+
return -EIO;
686686
if (xdr_stream_decode_u32(xdr, &attrlen) < 0)
687-
return -NFSERR_BAD_XDR;
687+
return -EIO;
688688
maxlen = sizeof(ncf->ncf_cb_change) + sizeof(ncf->ncf_cb_fsize);
689689
if (bitmap[2] != 0)
690690
maxlen += (sizeof(ncf->ncf_cb_mtime.tv_sec) +
691691
sizeof(ncf->ncf_cb_mtime.tv_nsec)) * 2;
692692
if (attrlen > maxlen)
693-
return -NFSERR_BAD_XDR;
693+
return -EIO;
694694
status = decode_cb_fattr4(xdr, bitmap, ncf);
695695
return status;
696696
}

0 commit comments

Comments
 (0)