diff options
| author | Chuck Lever <chuck.lever@oracle.com> | 2014-11-08 20:15:18 -0500 |
|---|---|---|
| committer | Anna Schumaker <Anna.Schumaker@Netapp.com> | 2014-11-25 16:22:16 -0500 |
| commit | 6dd3436b9dc0df4b9ae7bb4e0076996a5ffda219 (patch) | |
| tree | b01d1040b665452f8036cee5dc45bccf09fbc04b | |
| parent | edef1297f33a4546559d905457b435a5ea160bab (diff) | |
NFS: SETCLIENTID XDR buffer sizes are incorrect
Use the correct calculation of the maximum size of a clientaddr4
when encoding and decoding SETCLIENTID operations. clientaddr4 is
defined in section 2.2.10 of RFC3530bis-31.
The usage in encode_setclientid_maxsz is missing the 4-byte length
in both strings, but is otherwise correct. decode_setclientid_maxsz
simply asks for a page of receive buffer space, which is
unnecessarily large (more than 4KB).
Note that a SETCLIENTID reply is either clientid+verifier, or
clientaddr4, depending on the returned NFS status. It doesn't
hurt to allocate enough space for both.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
| -rw-r--r-- | fs/nfs/nfs4xdr.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 206c08a60c7f..f8afa6783fb8 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
| @@ -141,13 +141,15 @@ static int nfs4_stat_to_errno(int); | |||
| 141 | XDR_QUADLEN(NFS4_VERIFIER_SIZE) + \ | 141 | XDR_QUADLEN(NFS4_VERIFIER_SIZE) + \ |
| 142 | XDR_QUADLEN(NFS4_SETCLIENTID_NAMELEN) + \ | 142 | XDR_QUADLEN(NFS4_SETCLIENTID_NAMELEN) + \ |
| 143 | 1 /* sc_prog */ + \ | 143 | 1 /* sc_prog */ + \ |
| 144 | XDR_QUADLEN(RPCBIND_MAXNETIDLEN) + \ | 144 | 1 + XDR_QUADLEN(RPCBIND_MAXNETIDLEN) + \ |
| 145 | XDR_QUADLEN(RPCBIND_MAXUADDRLEN) + \ | 145 | 1 + XDR_QUADLEN(RPCBIND_MAXUADDRLEN) + \ |
| 146 | 1) /* sc_cb_ident */ | 146 | 1) /* sc_cb_ident */ |
| 147 | #define decode_setclientid_maxsz \ | 147 | #define decode_setclientid_maxsz \ |
| 148 | (op_decode_hdr_maxsz + \ | 148 | (op_decode_hdr_maxsz + \ |
| 149 | 2 + \ | 149 | 2 /* clientid */ + \ |
| 150 | 1024) /* large value for CLID_INUSE */ | 150 | XDR_QUADLEN(NFS4_VERIFIER_SIZE) + \ |
| 151 | 1 + XDR_QUADLEN(RPCBIND_MAXNETIDLEN) + \ | ||
| 152 | 1 + XDR_QUADLEN(RPCBIND_MAXUADDRLEN)) | ||
| 151 | #define encode_setclientid_confirm_maxsz \ | 153 | #define encode_setclientid_confirm_maxsz \ |
| 152 | (op_encode_hdr_maxsz + \ | 154 | (op_encode_hdr_maxsz + \ |
| 153 | 3 + (NFS4_VERIFIER_SIZE >> 2)) | 155 | 3 + (NFS4_VERIFIER_SIZE >> 2)) |
