diff options
author | J. Bruce Fields <bfields@redhat.com> | 2013-04-09 11:34:36 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2013-04-09 16:53:56 -0400 |
commit | 06b332a52293a45324320b6b446a7fa677fb6702 (patch) | |
tree | 4629ff4b2eb7bdf85593db7d24f362a5561c9e59 /fs/nfsd/nfs4state.c | |
parent | 55c760cfc40d75b4d8a17d56580ec306db2ab14f (diff) |
nfsd4: check backchannel attributes on create_session
Make sure the client gives us an adequate backchannel.
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r-- | fs/nfsd/nfs4state.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 036d5f16fd7f..67017fcebb21 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <linux/sunrpc/svcauth_gss.h> | 42 | #include <linux/sunrpc/svcauth_gss.h> |
43 | #include <linux/sunrpc/addr.h> | 43 | #include <linux/sunrpc/addr.h> |
44 | #include "xdr4.h" | 44 | #include "xdr4.h" |
45 | #include "xdr4cb.h" | ||
45 | #include "vfs.h" | 46 | #include "vfs.h" |
46 | #include "current_stateid.h" | 47 | #include "current_stateid.h" |
47 | 48 | ||
@@ -1794,6 +1795,27 @@ static __be32 check_forechannel_attrs(struct nfsd4_channel_attrs *ca, struct nfs | |||
1794 | return nfs_ok; | 1795 | return nfs_ok; |
1795 | } | 1796 | } |
1796 | 1797 | ||
1798 | static __be32 check_backchannel_attrs(struct nfsd4_channel_attrs *ca) | ||
1799 | { | ||
1800 | ca->headerpadsz = 0; | ||
1801 | |||
1802 | /* | ||
1803 | * These RPC_MAX_HEADER macros are overkill, especially since we | ||
1804 | * don't even do gss on the backchannel yet. But this is still | ||
1805 | * less than 1k. Tighten up this estimate in the unlikely event | ||
1806 | * it turns out to be a problem for some client: | ||
1807 | */ | ||
1808 | if (ca->maxreq_sz < NFS4_enc_cb_recall_sz + RPC_MAX_HEADER_WITH_AUTH) | ||
1809 | return nfserr_toosmall; | ||
1810 | if (ca->maxresp_sz < NFS4_dec_cb_recall_sz + RPC_MAX_REPHEADER_WITH_AUTH) | ||
1811 | return nfserr_toosmall; | ||
1812 | ca->maxresp_cached = 0; | ||
1813 | if (ca->maxops < 2) | ||
1814 | return nfserr_toosmall; | ||
1815 | |||
1816 | return nfs_ok; | ||
1817 | } | ||
1818 | |||
1797 | __be32 | 1819 | __be32 |
1798 | nfsd4_create_session(struct svc_rqst *rqstp, | 1820 | nfsd4_create_session(struct svc_rqst *rqstp, |
1799 | struct nfsd4_compound_state *cstate, | 1821 | struct nfsd4_compound_state *cstate, |
@@ -1812,6 +1834,9 @@ nfsd4_create_session(struct svc_rqst *rqstp, | |||
1812 | status = check_forechannel_attrs(&cr_ses->fore_channel, nn); | 1834 | status = check_forechannel_attrs(&cr_ses->fore_channel, nn); |
1813 | if (status) | 1835 | if (status) |
1814 | return status; | 1836 | return status; |
1837 | status = check_backchannel_attrs(&cr_ses->back_channel); | ||
1838 | if (status) | ||
1839 | return status; | ||
1815 | status = nfserr_jukebox; | 1840 | status = nfserr_jukebox; |
1816 | new = alloc_session(&cr_ses->fore_channel); | 1841 | new = alloc_session(&cr_ses->fore_channel); |
1817 | if (!new) | 1842 | if (!new) |