aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2007-12-10 14:56:54 -0500
committerTrond Myklebust <Trond.Myklebust@netapp.com>2008-01-30 02:05:51 -0500
commitcc38bac3a0093b3b7928efc6ff8e9faf9e75f41d (patch)
tree971f0653619e9068408d2938af37147f7448a53d
parent0fb2b7e945f55a8317e5f58db7c068aab5b825a1 (diff)
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: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r--fs/nfs/nfs4xdr.c10
-rw-r--r--include/linux/nfs_xdr.h13
2 files changed, 13 insertions, 10 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index eae46f008da7..db1ed9c46ede 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -116,10 +116,12 @@ static int nfs4_stat_to_errno(int);
116#define decode_renew_maxsz (op_decode_hdr_maxsz) 116#define decode_renew_maxsz (op_decode_hdr_maxsz)
117#define encode_setclientid_maxsz \ 117#define encode_setclientid_maxsz \
118 (op_encode_hdr_maxsz + \ 118 (op_encode_hdr_maxsz + \
119 4 /*server->ip_addr*/ + \ 119 XDR_QUADLEN(NFS4_VERIFIER_SIZE) + \
120 1 /*Netid*/ + \ 120 XDR_QUADLEN(NFS4_SETCLIENTID_NAMELEN) + \
121 6 /*uaddr*/ + \ 121 1 /* sc_prog */ + \
122 6 + (NFS4_VERIFIER_SIZE >> 2)) 122 XDR_QUADLEN(RPCBIND_MAXNETIDLEN) + \
123 XDR_QUADLEN(RPCBIND_MAXUADDRLEN) + \
124 1) /* sc_cb_ident */
123#define decode_setclientid_maxsz \ 125#define decode_setclientid_maxsz \
124 (op_decode_hdr_maxsz + \ 126 (op_decode_hdr_maxsz + \
125 2 + \ 127 2 + \
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 6b213a64b15f..d8e395d0c7c9 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -666,16 +666,17 @@ struct nfs4_rename_res {
666 struct nfs_fattr * new_fattr; 666 struct nfs_fattr * new_fattr;
667}; 667};
668 668
669#define NFS4_SETCLIENTID_NAMELEN (48)
669struct nfs4_setclientid { 670struct nfs4_setclientid {
670 const nfs4_verifier * sc_verifier; /* request */ 671 const nfs4_verifier * sc_verifier;
671 unsigned int sc_name_len; 672 unsigned int sc_name_len;
672 char sc_name[48]; /* request */ 673 char sc_name[NFS4_SETCLIENTID_NAMELEN];
673 u32 sc_prog; /* request */ 674 u32 sc_prog;
674 unsigned int sc_netid_len; 675 unsigned int sc_netid_len;
675 char sc_netid[4]; /* request */ 676 char sc_netid[RPCBIND_MAXNETIDLEN];
676 unsigned int sc_uaddr_len; 677 unsigned int sc_uaddr_len;
677 char sc_uaddr[24]; /* request */ 678 char sc_uaddr[RPCBIND_MAXUADDRLEN];
678 u32 sc_cb_ident; /* request */ 679 u32 sc_cb_ident;
679}; 680};
680 681
681struct nfs4_statfs_arg { 682struct nfs4_statfs_arg {