aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMi Jinlong <mijinlong@cn.fujitsu.com>2011-03-23 05:57:07 -0400
committerJ. Bruce Fields <bfields@redhat.com>2011-04-29 20:47:53 -0400
commita62573dc353b255dbbc8520bfdcb1c8a8c1ada87 (patch)
tree23c0b4cd8dfe6a0670237d946df6b5b184c25f1b
parentac6721a13e5b1a90728e790600f827a5e5f5da2f (diff)
nfsd41: add flag checking for create_session
Teach the NFS server to reject invalid create_session flags. Also do some minor formatting adjustments. Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
-rw-r--r--fs/nfsd/nfs4state.c3
-rw-r--r--include/linux/nfs4.h8
2 files changed, 8 insertions, 3 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index fbde6f79922e..6dbaa379c863 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -1515,6 +1515,9 @@ nfsd4_create_session(struct svc_rqst *rqstp,
1515 bool confirm_me = false; 1515 bool confirm_me = false;
1516 int status = 0; 1516 int status = 0;
1517 1517
1518 if (cr_ses->flags & ~SESSION4_FLAG_MASK_A)
1519 return nfserr_inval;
1520
1518 nfs4_lock_state(); 1521 nfs4_lock_state();
1519 unconf = find_unconfirmed_client(&cr_ses->clientid); 1522 unconf = find_unconfirmed_client(&cr_ses->clientid);
1520 conf = find_confirmed_client(&cr_ses->clientid); 1523 conf = find_confirmed_client(&cr_ses->clientid);
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index b528f6d4b860..8937727e7039 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -570,9 +570,11 @@ struct nfs4_sessionid {
570}; 570};
571 571
572/* Create Session Flags */ 572/* Create Session Flags */
573#define SESSION4_PERSIST 0x001 573#define SESSION4_PERSIST 0x001
574#define SESSION4_BACK_CHAN 0x002 574#define SESSION4_BACK_CHAN 0x002
575#define SESSION4_RDMA 0x004 575#define SESSION4_RDMA 0x004
576
577#define SESSION4_FLAG_MASK_A 0x007
576 578
577enum state_protect_how4 { 579enum state_protect_how4 {
578 SP4_NONE = 0, 580 SP4_NONE = 0,