aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2013-04-08 15:42:12 -0400
committerJ. Bruce Fields <bfields@redhat.com>2013-04-09 15:49:50 -0400
commit373cd4098a6392395af63af220d989df00b444f7 (patch)
tree550e1ef40cfbf0b986e4422fa8354ed70023572f /fs/nfsd
parent0c7c3e67ab91ec6caa44bdf1fc89a48012ceb0c5 (diff)
nfsd4: cleanup check_forechannel_attrs
Pass this struct by reference, not by value, and return an error instead of a boolean to allow for future additions. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd')
-rw-r--r--fs/nfsd/nfs4state.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 7d2e3b54b9df..f1262f73f08b 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -1803,10 +1803,13 @@ nfsd4_replay_create_session(struct nfsd4_create_session *cr_ses,
1803 /* seqid, slotID, slotID, slotID, status */ \ 1803 /* seqid, slotID, slotID, slotID, status */ \
1804 5 ) * sizeof(__be32)) 1804 5 ) * sizeof(__be32))
1805 1805
1806static bool check_forechannel_attrs(struct nfsd4_channel_attrs fchannel) 1806static __be32 check_forechannel_attrs(struct nfsd4_channel_attrs *ca)
1807{ 1807{
1808 return fchannel.maxreq_sz < NFSD_MIN_REQ_HDR_SEQ_SZ 1808 if (ca->maxreq_sz < NFSD_MIN_REQ_HDR_SEQ_SZ)
1809 || fchannel.maxresp_sz < NFSD_MIN_RESP_HDR_SEQ_SZ; 1809 return nfserr_toosmall;
1810 if (ca->maxresp_sz < NFSD_MIN_RESP_HDR_SEQ_SZ)
1811 return nfserr_toosmall;
1812 return nfs_ok;
1810} 1813}
1811 1814
1812__be32 1815__be32
@@ -1824,8 +1827,9 @@ nfsd4_create_session(struct svc_rqst *rqstp,
1824 1827
1825 if (cr_ses->flags & ~SESSION4_FLAG_MASK_A) 1828 if (cr_ses->flags & ~SESSION4_FLAG_MASK_A)
1826 return nfserr_inval; 1829 return nfserr_inval;
1827 if (check_forechannel_attrs(cr_ses->fore_channel)) 1830 status = check_forechannel_attrs(&cr_ses->fore_channel);
1828 return nfserr_toosmall; 1831 if (status)
1832 return status;
1829 new = alloc_session(&cr_ses->fore_channel, nn); 1833 new = alloc_session(&cr_ses->fore_channel, nn);
1830 if (!new) 1834 if (!new)
1831 return nfserr_jukebox; 1835 return nfserr_jukebox;