Re: nfsd41: add flag checking for create_session

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 23, 2011 at 05:57:07PM +0800, Mi Jinlong wrote:
> At the latest kernel, NFS server doesn't check create_session 
> operation's falg.
> 
> This patch add flag mask and check flag for create_session
>  as exchang_id. Also, make some adjustment for align.

A clients sending undefined flags is out of spec as far as I can tell,
and I'm not sure we owe them any particular error.

But perhaps erroring out is useful for debugging at least, OK.  Applying
for 2.6.40.

--b.

> 
> Signed-off-by: Mi Jinlong <mijinlong@xxxxxxxxxxxxxx>
> ---
>  fs/nfsd/nfs4state.c  |    3 +++
>  include/linux/nfs4.h |    8 +++++---
>  2 files changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index 7b566ec..1f66370 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -1514,6 +1514,9 @@ nfsd4_create_session(struct svc_rqst *rqstp,
>  	bool confirm_me = false;
>  	int status = 0;
>  
> +	if (cr_ses->flags & ~SESSION4_FLAG_MASK_A)
> +		return nfserr_inval;
> +
>  	nfs4_lock_state();
>  	unconf = find_unconfirmed_client(&cr_ses->clientid);
>  	conf = find_confirmed_client(&cr_ses->clientid);
> diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
> index 134716e..e064895 100644
> --- a/include/linux/nfs4.h
> +++ b/include/linux/nfs4.h
> @@ -568,9 +568,11 @@ struct nfs4_sessionid {
>  };
>  
>  /* Create Session Flags */
> -#define SESSION4_PERSIST	 0x001
> -#define SESSION4_BACK_CHAN 	 0x002
> -#define SESSION4_RDMA		 0x004
> +#define SESSION4_PERSIST	0x001
> +#define SESSION4_BACK_CHAN	0x002
> +#define SESSION4_RDMA		0x004
> +
> +#define SESSION4_FLAG_MASK_A	0x007
>  
>  enum state_protect_how4 {
>  	SP4_NONE	= 0,
> -- 
> 1.7.4.1
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux