linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] NFSv4.1: Make sure nfsd can decode SP4_SSV correctly at exchange_id
@ 2010-11-05  7:33 Mi Jinlong
  2010-11-09  1:39 ` Mi Jinlong
  0 siblings, 1 reply; 5+ messages in thread
From: Mi Jinlong @ 2010-11-05  7:33 UTC (permalink / raw)
  To: Trond Myklebust(netapp), NFSv3 list

According to RFC, the argument of ssv_sp_parms4 is:

   struct ssv_sp_parms4 {
           state_protect_ops4      ssp_ops;
           sec_oid4                ssp_hash_algs<>;
           sec_oid4                ssp_encr_algs<>;
           uint32_t                ssp_window;
           uint32_t                ssp_num_gss_handles;
   };

If client send a exchange_id with SP4_SSV, server cann't decode
the SP4_SSV's ssp_hash_algs and ssp_encr_algs arguments correctly.

Because the kernel treat the two arguments as a signal 
sec_oid4 struct, but should be a set of sec_oid4 struct.

---
 fs/nfsd/nfs4xdr.c |   22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index f35a94a..71d7d33 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -1005,7 +1005,7 @@ static __be32
 nfsd4_decode_exchange_id(struct nfsd4_compoundargs *argp,
 			 struct nfsd4_exchange_id *exid)
 {
-	int dummy;
+	int dummy, tmp;
 	DECODE_HEAD;
 
 	READ_BUF(NFS4_VERIFIER_SIZE);
@@ -1053,15 +1053,23 @@ nfsd4_decode_exchange_id(struct nfsd4_compoundargs *argp,
 
 		/* ssp_hash_algs<> */
 		READ_BUF(4);
-		READ32(dummy);
-		READ_BUF(dummy);
-		p += XDR_QUADLEN(dummy);
+		READ32(tmp);
+		while (tmp--) {
+			READ_BUF(4);
+			READ32(dummy);
+			READ_BUF(dummy);
+			p += XDR_QUADLEN(dummy);
+		}
 
 		/* ssp_encr_algs<> */
 		READ_BUF(4);
-		READ32(dummy);
-		READ_BUF(dummy);
-		p += XDR_QUADLEN(dummy);
+		READ32(tmp);
+		while (tmp--) {
+			READ_BUF(4);
+			READ32(dummy);
+			READ_BUF(dummy);
+			p += XDR_QUADLEN(dummy);
+		}
 
 		/* ssp_window and ssp_num_gss_handles */
 		READ_BUF(8);
-- 
1.7.0.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] NFSv4.1: Make sure nfsd can decode SP4_SSV correctly at exchange_id
  2010-11-05  7:33 [PATCH] NFSv4.1: Make sure nfsd can decode SP4_SSV correctly at exchange_id Mi Jinlong
@ 2010-11-09  1:39 ` Mi Jinlong
  2010-11-10 19:34   ` J. Bruce Fields
  0 siblings, 1 reply; 5+ messages in thread
From: Mi Jinlong @ 2010-11-09  1:39 UTC (permalink / raw)
  To: NFSv3 list

According to RFC, the argument of ssv_sp_parms4 is:

   struct ssv_sp_parms4 {
           state_protect_ops4      ssp_ops;
           sec_oid4                ssp_hash_algs<>;
           sec_oid4                ssp_encr_algs<>;
           uint32_t                ssp_window;
           uint32_t                ssp_num_gss_handles;
   };

If client send a exchange_id with SP4_SSV, server cann't decode
the SP4_SSV's ssp_hash_algs and ssp_encr_algs arguments correctly.

Because the kernel treat the two arguments as a signal 
sec_oid4 struct, but should be a set of sec_oid4 struct.

Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com>
---
 fs/nfsd/nfs4xdr.c |   22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index f35a94a..71d7d33 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -1005,7 +1005,7 @@ static __be32
 nfsd4_decode_exchange_id(struct nfsd4_compoundargs *argp,
 			 struct nfsd4_exchange_id *exid)
 {
-	int dummy;
+	int dummy, tmp;
 	DECODE_HEAD;
 
 	READ_BUF(NFS4_VERIFIER_SIZE);
@@ -1053,15 +1053,23 @@ nfsd4_decode_exchange_id(struct nfsd4_compoundargs *argp,
 
 		/* ssp_hash_algs<> */
 		READ_BUF(4);
-		READ32(dummy);
-		READ_BUF(dummy);
-		p += XDR_QUADLEN(dummy);
+		READ32(tmp);
+		while (tmp--) {
+			READ_BUF(4);
+			READ32(dummy);
+			READ_BUF(dummy);
+			p += XDR_QUADLEN(dummy);
+		}
 
 		/* ssp_encr_algs<> */
 		READ_BUF(4);
-		READ32(dummy);
-		READ_BUF(dummy);
-		p += XDR_QUADLEN(dummy);
+		READ32(tmp);
+		while (tmp--) {
+			READ_BUF(4);
+			READ32(dummy);
+			READ_BUF(dummy);
+			p += XDR_QUADLEN(dummy);
+		}
 
 		/* ssp_window and ssp_num_gss_handles */
 		READ_BUF(8);
-- 1.7.0.1 


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] NFSv4.1: Make sure nfsd can decode SP4_SSV correctly at exchange_id
  2010-11-09  1:39 ` Mi Jinlong
@ 2010-11-10 19:34   ` J. Bruce Fields
  2010-11-11  1:21     ` Mi Jinlong
  0 siblings, 1 reply; 5+ messages in thread
From: J. Bruce Fields @ 2010-11-10 19:34 UTC (permalink / raw)
  To: Mi Jinlong; +Cc: NFSv3 list

On Tue, Nov 09, 2010 at 09:39:23AM +0800, Mi Jinlong wrote:
> According to RFC, the argument of ssv_sp_parms4 is:
> 
>    struct ssv_sp_parms4 {
>            state_protect_ops4      ssp_ops;
>            sec_oid4                ssp_hash_algs<>;
>            sec_oid4                ssp_encr_algs<>;
>            uint32_t                ssp_window;
>            uint32_t                ssp_num_gss_handles;
>    };
> 
> If client send a exchange_id with SP4_SSV, server cann't decode
> the SP4_SSV's ssp_hash_algs and ssp_encr_algs arguments correctly.
> 
> Because the kernel treat the two arguments as a signal 
> sec_oid4 struct, but should be a set of sec_oid4 struct.

That looks correct, thanks.

(How are you testing this?)

--b.

> 
> Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com>
> ---
>  fs/nfsd/nfs4xdr.c |   22 +++++++++++++++-------
>  1 files changed, 15 insertions(+), 7 deletions(-)
> 
> diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
> index f35a94a..71d7d33 100644
> --- a/fs/nfsd/nfs4xdr.c
> +++ b/fs/nfsd/nfs4xdr.c
> @@ -1005,7 +1005,7 @@ static __be32
>  nfsd4_decode_exchange_id(struct nfsd4_compoundargs *argp,
>  			 struct nfsd4_exchange_id *exid)
>  {
> -	int dummy;
> +	int dummy, tmp;
>  	DECODE_HEAD;
>  
>  	READ_BUF(NFS4_VERIFIER_SIZE);
> @@ -1053,15 +1053,23 @@ nfsd4_decode_exchange_id(struct nfsd4_compoundargs *argp,
>  
>  		/* ssp_hash_algs<> */
>  		READ_BUF(4);
> -		READ32(dummy);
> -		READ_BUF(dummy);
> -		p += XDR_QUADLEN(dummy);
> +		READ32(tmp);
> +		while (tmp--) {
> +			READ_BUF(4);
> +			READ32(dummy);
> +			READ_BUF(dummy);
> +			p += XDR_QUADLEN(dummy);
> +		}
>  
>  		/* ssp_encr_algs<> */
>  		READ_BUF(4);
> -		READ32(dummy);
> -		READ_BUF(dummy);
> -		p += XDR_QUADLEN(dummy);
> +		READ32(tmp);
> +		while (tmp--) {
> +			READ_BUF(4);
> +			READ32(dummy);
> +			READ_BUF(dummy);
> +			p += XDR_QUADLEN(dummy);
> +		}
>  
>  		/* ssp_window and ssp_num_gss_handles */
>  		READ_BUF(8);
> -- 1.7.0.1 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] NFSv4.1: Make sure nfsd can decode SP4_SSV correctly at exchange_id
  2010-11-10 19:34   ` J. Bruce Fields
@ 2010-11-11  1:21     ` Mi Jinlong
  2010-11-12 19:40       ` J. Bruce Fields
  0 siblings, 1 reply; 5+ messages in thread
From: Mi Jinlong @ 2010-11-11  1:21 UTC (permalink / raw)
  To: J. Bruce Fields; +Cc: NFSv3 list



J. Bruce Fields :
> On Tue, Nov 09, 2010 at 09:39:23AM +0800, Mi Jinlong wrote:
>> According to RFC, the argument of ssv_sp_parms4 is:
>>
>>    struct ssv_sp_parms4 {
>>            state_protect_ops4      ssp_ops;
>>            sec_oid4                ssp_hash_algs<>;
>>            sec_oid4                ssp_encr_algs<>;
>>            uint32_t                ssp_window;
>>            uint32_t                ssp_num_gss_handles;
>>    };
>>
>> If client send a exchange_id with SP4_SSV, server cann't decode
>> the SP4_SSV's ssp_hash_algs and ssp_encr_algs arguments correctly.
>>
>> Because the kernel treat the two arguments as a signal 
>> sec_oid4 struct, but should be a set of sec_oid4 struct.
> 
> That looks correct, thanks.
> 
> (How are you testing this?)

  I use the pynfs41 test site at your git tree. (EID50)

thanks,
Mi Jinlong

> 
> --b.
> 
>> Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com>
>> ---
>>  fs/nfsd/nfs4xdr.c |   22 +++++++++++++++-------
>>  1 files changed, 15 insertions(+), 7 deletions(-)
>>
>> diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
>> index f35a94a..71d7d33 100644
>> --- a/fs/nfsd/nfs4xdr.c
>> +++ b/fs/nfsd/nfs4xdr.c
>> @@ -1005,7 +1005,7 @@ static __be32
>>  nfsd4_decode_exchange_id(struct nfsd4_compoundargs *argp,
>>  			 struct nfsd4_exchange_id *exid)
>>  {
>> -	int dummy;
>> +	int dummy, tmp;
>>  	DECODE_HEAD;
>>  
>>  	READ_BUF(NFS4_VERIFIER_SIZE);
>> @@ -1053,15 +1053,23 @@ nfsd4_decode_exchange_id(struct nfsd4_compoundargs *argp,
>>  
>>  		/* ssp_hash_algs<> */
>>  		READ_BUF(4);
>> -		READ32(dummy);
>> -		READ_BUF(dummy);
>> -		p += XDR_QUADLEN(dummy);
>> +		READ32(tmp);
>> +		while (tmp--) {
>> +			READ_BUF(4);
>> +			READ32(dummy);
>> +			READ_BUF(dummy);
>> +			p += XDR_QUADLEN(dummy);
>> +		}
>>  
>>  		/* ssp_encr_algs<> */
>>  		READ_BUF(4);
>> -		READ32(dummy);
>> -		READ_BUF(dummy);
>> -		p += XDR_QUADLEN(dummy);
>> +		READ32(tmp);
>> +		while (tmp--) {
>> +			READ_BUF(4);
>> +			READ32(dummy);
>> +			READ_BUF(dummy);
>> +			p += XDR_QUADLEN(dummy);
>> +		}
>>  
>>  		/* ssp_window and ssp_num_gss_handles */
>>  		READ_BUF(8);
>> -- 1.7.0.1 
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 

-- 
----
Regards
Mi Jinlong


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] NFSv4.1: Make sure nfsd can decode SP4_SSV correctly at exchange_id
  2010-11-11  1:21     ` Mi Jinlong
@ 2010-11-12 19:40       ` J. Bruce Fields
  0 siblings, 0 replies; 5+ messages in thread
From: J. Bruce Fields @ 2010-11-12 19:40 UTC (permalink / raw)
  To: Mi Jinlong; +Cc: NFSv3 list

On Thu, Nov 11, 2010 at 09:21:26AM +0800, Mi Jinlong wrote:
> 
> 
> J. Bruce Fields :
> > On Tue, Nov 09, 2010 at 09:39:23AM +0800, Mi Jinlong wrote:
> >> According to RFC, the argument of ssv_sp_parms4 is:
> >>
> >>    struct ssv_sp_parms4 {
> >>            state_protect_ops4      ssp_ops;
> >>            sec_oid4                ssp_hash_algs<>;
> >>            sec_oid4                ssp_encr_algs<>;
> >>            uint32_t                ssp_window;
> >>            uint32_t                ssp_num_gss_handles;
> >>    };
> >>
> >> If client send a exchange_id with SP4_SSV, server cann't decode
> >> the SP4_SSV's ssp_hash_algs and ssp_encr_algs arguments correctly.
> >>
> >> Because the kernel treat the two arguments as a signal 
> >> sec_oid4 struct, but should be a set of sec_oid4 struct.
> > 
> > That looks correct, thanks.
> > 
> > (How are you testing this?)
> 
>   I use the pynfs41 test site at your git tree. (EID50)

Got it, thanks; queueing for 2.6.38.

--b.

> 
> thanks,
> Mi Jinlong
> 
> > 
> > --b.
> > 
> >> Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com>
> >> ---
> >>  fs/nfsd/nfs4xdr.c |   22 +++++++++++++++-------
> >>  1 files changed, 15 insertions(+), 7 deletions(-)
> >>
> >> diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
> >> index f35a94a..71d7d33 100644
> >> --- a/fs/nfsd/nfs4xdr.c
> >> +++ b/fs/nfsd/nfs4xdr.c
> >> @@ -1005,7 +1005,7 @@ static __be32
> >>  nfsd4_decode_exchange_id(struct nfsd4_compoundargs *argp,
> >>  			 struct nfsd4_exchange_id *exid)
> >>  {
> >> -	int dummy;
> >> +	int dummy, tmp;
> >>  	DECODE_HEAD;
> >>  
> >>  	READ_BUF(NFS4_VERIFIER_SIZE);
> >> @@ -1053,15 +1053,23 @@ nfsd4_decode_exchange_id(struct nfsd4_compoundargs *argp,
> >>  
> >>  		/* ssp_hash_algs<> */
> >>  		READ_BUF(4);
> >> -		READ32(dummy);
> >> -		READ_BUF(dummy);
> >> -		p += XDR_QUADLEN(dummy);
> >> +		READ32(tmp);
> >> +		while (tmp--) {
> >> +			READ_BUF(4);
> >> +			READ32(dummy);
> >> +			READ_BUF(dummy);
> >> +			p += XDR_QUADLEN(dummy);
> >> +		}
> >>  
> >>  		/* ssp_encr_algs<> */
> >>  		READ_BUF(4);
> >> -		READ32(dummy);
> >> -		READ_BUF(dummy);
> >> -		p += XDR_QUADLEN(dummy);
> >> +		READ32(tmp);
> >> +		while (tmp--) {
> >> +			READ_BUF(4);
> >> +			READ32(dummy);
> >> +			READ_BUF(dummy);
> >> +			p += XDR_QUADLEN(dummy);
> >> +		}
> >>  
> >>  		/* ssp_window and ssp_num_gss_handles */
> >>  		READ_BUF(8);
> >> -- 1.7.0.1 
> >>
> >> --
> >> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> >> the body of a message to majordomo@vger.kernel.org
> >> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > 
> > 
> 
> -- 
> ----
> Regards
> Mi Jinlong
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-11-12 19:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-05  7:33 [PATCH] NFSv4.1: Make sure nfsd can decode SP4_SSV correctly at exchange_id Mi Jinlong
2010-11-09  1:39 ` Mi Jinlong
2010-11-10 19:34   ` J. Bruce Fields
2010-11-11  1:21     ` Mi Jinlong
2010-11-12 19:40       ` J. Bruce Fields

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).