NFSD: Add a separate decoder to handle state_protect_ops
[ Upstream commit 2548aa784d760567c2a77cbd8b7c55b211167c37 ] Refactor for clarity and de-duplication of code. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
75e7eb55d1
commit
0316890507
1 changed files with 23 additions and 43 deletions
|
@ -315,32 +315,6 @@ nfsd4_decode_verifier4(struct nfsd4_compoundargs *argp, nfs4_verifier *verf)
|
||||||
return nfs_ok;
|
return nfs_ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
static __be32
|
|
||||||
nfsd4_decode_bitmap(struct nfsd4_compoundargs *argp, u32 *bmval)
|
|
||||||
{
|
|
||||||
u32 bmlen;
|
|
||||||
DECODE_HEAD;
|
|
||||||
|
|
||||||
bmval[0] = 0;
|
|
||||||
bmval[1] = 0;
|
|
||||||
bmval[2] = 0;
|
|
||||||
|
|
||||||
READ_BUF(4);
|
|
||||||
bmlen = be32_to_cpup(p++);
|
|
||||||
if (bmlen > 1000)
|
|
||||||
goto xdr_error;
|
|
||||||
|
|
||||||
READ_BUF(bmlen << 2);
|
|
||||||
if (bmlen > 0)
|
|
||||||
bmval[0] = be32_to_cpup(p++);
|
|
||||||
if (bmlen > 1)
|
|
||||||
bmval[1] = be32_to_cpup(p++);
|
|
||||||
if (bmlen > 2)
|
|
||||||
bmval[2] = be32_to_cpup(p++);
|
|
||||||
|
|
||||||
DECODE_TAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* nfsd4_decode_bitmap4 - Decode an NFSv4 bitmap4
|
* nfsd4_decode_bitmap4 - Decode an NFSv4 bitmap4
|
||||||
* @argp: NFSv4 compound argument structure
|
* @argp: NFSv4 compound argument structure
|
||||||
|
@ -1496,6 +1470,24 @@ static __be32 nfsd4_decode_bind_conn_to_session(struct nfsd4_compoundargs *argp,
|
||||||
return nfs_ok;
|
return nfs_ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static __be32
|
||||||
|
nfsd4_decode_state_protect_ops(struct nfsd4_compoundargs *argp,
|
||||||
|
struct nfsd4_exchange_id *exid)
|
||||||
|
{
|
||||||
|
__be32 status;
|
||||||
|
|
||||||
|
status = nfsd4_decode_bitmap4(argp, exid->spo_must_enforce,
|
||||||
|
ARRAY_SIZE(exid->spo_must_enforce));
|
||||||
|
if (status)
|
||||||
|
return nfserr_bad_xdr;
|
||||||
|
status = nfsd4_decode_bitmap4(argp, exid->spo_must_allow,
|
||||||
|
ARRAY_SIZE(exid->spo_must_allow));
|
||||||
|
if (status)
|
||||||
|
return nfserr_bad_xdr;
|
||||||
|
|
||||||
|
return nfs_ok;
|
||||||
|
}
|
||||||
|
|
||||||
static __be32
|
static __be32
|
||||||
nfsd4_decode_exchange_id(struct nfsd4_compoundargs *argp,
|
nfsd4_decode_exchange_id(struct nfsd4_compoundargs *argp,
|
||||||
struct nfsd4_exchange_id *exid)
|
struct nfsd4_exchange_id *exid)
|
||||||
|
@ -1520,27 +1512,15 @@ nfsd4_decode_exchange_id(struct nfsd4_compoundargs *argp,
|
||||||
case SP4_NONE:
|
case SP4_NONE:
|
||||||
break;
|
break;
|
||||||
case SP4_MACH_CRED:
|
case SP4_MACH_CRED:
|
||||||
/* spo_must_enforce */
|
status = nfsd4_decode_state_protect_ops(argp, exid);
|
||||||
status = nfsd4_decode_bitmap(argp,
|
|
||||||
exid->spo_must_enforce);
|
|
||||||
if (status)
|
if (status)
|
||||||
goto out;
|
return status;
|
||||||
/* spo_must_allow */
|
|
||||||
status = nfsd4_decode_bitmap(argp, exid->spo_must_allow);
|
|
||||||
if (status)
|
|
||||||
goto out;
|
|
||||||
break;
|
break;
|
||||||
case SP4_SSV:
|
case SP4_SSV:
|
||||||
/* ssp_ops */
|
/* ssp_ops */
|
||||||
READ_BUF(4);
|
status = nfsd4_decode_state_protect_ops(argp, exid);
|
||||||
dummy = be32_to_cpup(p++);
|
if (status)
|
||||||
READ_BUF(dummy * 4);
|
return status;
|
||||||
p += dummy;
|
|
||||||
|
|
||||||
READ_BUF(4);
|
|
||||||
dummy = be32_to_cpup(p++);
|
|
||||||
READ_BUF(dummy * 4);
|
|
||||||
p += dummy;
|
|
||||||
|
|
||||||
/* ssp_hash_algs<> */
|
/* ssp_hash_algs<> */
|
||||||
READ_BUF(4);
|
READ_BUF(4);
|
||||||
|
|
Loading…
Reference in a new issue