NFSD: fix decoding in nfs4_xdr_dec_cb_getattr
Subsystems (2)
Olga Kornievskaia
reviewerPATCH 1/1 NFSD: fix decoding in nfs4_xdr_dec_cb_getattr
If a client were to send an error to a CB_GETATTR call, the code erronously continues to try decode past the error code. It ends up returning BAD_XDR error to the rpc layer and then in turn trigger a WARN_ONCE in nfsd4_cb_done() function.
--- fs/nfsd/nfs4callback.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfsd/nfs4callback.c +1 -1
@@ -647,7 +647,7 @@ static int nfs4_xdr_dec_cb_getattr(struct rpc_rqst *rqstp,return status; status =decode_cb_op_status (xdr,OP_CB_GETATTR , &cb->cb_status); -if (status) +if (status || cb->cb_status)return status;if (xdr_stream_decode_uint32_array (xdr, bitmap,3 ) <0 )return -NFSERR_BAD_XDR ;
Signature · 1 line
2.43.5
Quoted 16 lines · Olga Kornievskaia
If a client were to send an error to a
CB_GETATTRcall, the code erronously continues to try decode past the error code. It ends up returningBAD_XDRerror to the rpc layer and then in turn trigger aWARN_ONCEinnfsd4_cb_done()function.Fixes 6487a13b5c6b ("NFSD: add support for CB_GETATTR callback")Signed-off-by Olga Kornievskaia <[email protected]>--- fs/nfsd/nfs4callback.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/nfsd/nfs4callback.c +0
-0
fs/nfsd/nfs4callback.c static int nfs4_xdr_dec_cb_getattr(struct rpc_rqst *rqstp, · line 653
Quoted 8 lines
fs/nfsd/nfs4callback.c +1
-1@@ -647,7 +647,7 @@ static int nfs4_xdr_dec_cb_getattr(struct rpc_rqst *rqstp,return status; status =decode_cb_op_status (xdr,OP_CB_GETATTR , &cb->cb_status); -if (status) +if (status || cb->cb_status)return status;if (xdr_stream_decode_uint32_array (xdr, bitmap,3 ) <0 )return -NFSERR_BAD_XDR ;
Nice catch!
Quoted 26 lines · Olga Kornievskaia
If a client were to send an error to a
CB_GETATTRcall, the code erronously continues to try decode past the error code. It ends up returningBAD_XDRerror to the rpc layer and then in turn trigger aWARN_ONCEinnfsd4_cb_done()function.Fixes 6487a13b5c6b ("NFSD: add support for CB_GETATTR callback")Signed-off-by Olga Kornievskaia <[email protected]>--- fs/nfsd/nfs4callback.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/nfsd/nfs4callback.c +1
-1@@ -647,7 +647,7 @@ static int nfs4_xdr_dec_cb_getattr(struct rpc_rqst *rqstp,return status; status =decode_cb_op_status (xdr,OP_CB_GETATTR , &cb->cb_status); -if (status) +if (status || cb->cb_status)return status;if (xdr_stream_decode_uint32_array (xdr, bitmap,3 ) <0 )return -NFSERR_BAD_XDR ;Signature · 1 line
2.43.5
Yep!
Ben
[email protected]
maintainerFrom: Chuck Lever <[email protected]>
Quoted 6 lines · Olga Kornievskaia
If a client were to send an error to a
CB_GETATTRcall, the code erronously continues to try decode past the error code. It ends up returningBAD_XDRerror to the rpc layer and then in turn trigger aWARN_ONCEinnfsd4_cb_done()function.
Applied to nfsd-testing for v6.14, thanks!
[1/1] NFSD: fix decoding in nfs4_xdr_dec_cb_getattr
commit: 06f2bda29525f103e83cbb8a306774d508c7801d
--
Chuck Lever
Jeff Layton
maintainerQuoted 16 lines · Olga Kornievskaia
If a client were to send an error to a
CB_GETATTRcall, the code erronously continues to try decode past the error code. It ends up returningBAD_XDRerror to the rpc layer and then in turn trigger aWARN_ONCEinnfsd4_cb_done()function.Fixes 6487a13b5c6b ("NFSD: add support for CB_GETATTR callback")Signed-off-by Olga Kornievskaia <[email protected]>--- fs/nfsd/nfs4callback.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/nfsd/nfs4callback.c +0
-0
fs/nfsd/nfs4callback.c static int nfs4_xdr_dec_cb_getattr(struct rpc_rqst *rqstp, · line 653
Quoted 8 lines
fs/nfsd/nfs4callback.c +1
-1@@ -647,7 +647,7 @@ static int nfs4_xdr_dec_cb_getattr(struct rpc_rqst *rqstp,return status; status =decode_cb_op_status (xdr,OP_CB_GETATTR , &cb->cb_status); -if (status) +if (status || cb->cb_status)return status;if (xdr_stream_decode_uint32_array (xdr, bitmap,3 ) <0 )return -NFSERR_BAD_XDR ;
I'm not sure what happened here, but the patch that got committed is checking cb->cb_seq_status instead of the patch above:
if (unlikely(status || cb->cb_seq_status))
The emailed patch is correct, but the above is bogus (and may be contributing to the warning reported here:
https://bugzilla.kernel.org/show_bug.cgi?id=219737#c9
Signature · 1 line
Jeff Layton <[email protected]>