Commit cc38bac3 authored by Chuck Lever's avatar Chuck Lever Committed by Trond Myklebust

NFS: Ensure NFSv4 SETCLIENTID send buffer is large enough

Ensure that the RPC buffer size specified for NFSv4 SETCLIENTID procedures
matches what we are encoding into the buffer.  See the definition of
struct nfs4_setclientid {} and the encode_setclientid() function.
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 0fb2b7e9
...@@ -116,10 +116,12 @@ static int nfs4_stat_to_errno(int); ...@@ -116,10 +116,12 @@ static int nfs4_stat_to_errno(int);
#define decode_renew_maxsz (op_decode_hdr_maxsz) #define decode_renew_maxsz (op_decode_hdr_maxsz)
#define encode_setclientid_maxsz \ #define encode_setclientid_maxsz \
(op_encode_hdr_maxsz + \ (op_encode_hdr_maxsz + \
4 /*server->ip_addr*/ + \ XDR_QUADLEN(NFS4_VERIFIER_SIZE) + \
1 /*Netid*/ + \ XDR_QUADLEN(NFS4_SETCLIENTID_NAMELEN) + \
6 /*uaddr*/ + \ 1 /* sc_prog */ + \
6 + (NFS4_VERIFIER_SIZE >> 2)) XDR_QUADLEN(RPCBIND_MAXNETIDLEN) + \
XDR_QUADLEN(RPCBIND_MAXUADDRLEN) + \
1) /* sc_cb_ident */
#define decode_setclientid_maxsz \ #define decode_setclientid_maxsz \
(op_decode_hdr_maxsz + \ (op_decode_hdr_maxsz + \
2 + \ 2 + \
......
...@@ -666,16 +666,17 @@ struct nfs4_rename_res { ...@@ -666,16 +666,17 @@ struct nfs4_rename_res {
struct nfs_fattr * new_fattr; struct nfs_fattr * new_fattr;
}; };
#define NFS4_SETCLIENTID_NAMELEN (48)
struct nfs4_setclientid { struct nfs4_setclientid {
const nfs4_verifier * sc_verifier; /* request */ const nfs4_verifier * sc_verifier;
unsigned int sc_name_len; unsigned int sc_name_len;
char sc_name[48]; /* request */ char sc_name[NFS4_SETCLIENTID_NAMELEN];
u32 sc_prog; /* request */ u32 sc_prog;
unsigned int sc_netid_len; unsigned int sc_netid_len;
char sc_netid[4]; /* request */ char sc_netid[RPCBIND_MAXNETIDLEN];
unsigned int sc_uaddr_len; unsigned int sc_uaddr_len;
char sc_uaddr[24]; /* request */ char sc_uaddr[RPCBIND_MAXUADDRLEN];
u32 sc_cb_ident; /* request */ u32 sc_cb_ident;
}; };
struct nfs4_statfs_arg { struct nfs4_statfs_arg {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment