Skip to content

Commit

Permalink
NFSv4.1: Make sure nfsd can decode SP4_SSV correctly at exchange_id
Browse files Browse the repository at this point in the history
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>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
  • Loading branch information
Mi Jinlong authored and J. Bruce Fields committed Nov 19, 2010
1 parent 9c335c0 commit 5afa040
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions fs/nfsd/nfs4xdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 5afa040

Please sign in to comment.