mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-05 18:39:59 +00:00
NFSD: Fix exposure in nfsd4_decode_bitmap()
rtm@csail.mit.edu reports:
> nfsd4_decode_bitmap4() will write beyond bmval[bmlen-1] if the RPC
> directs it to do so. This can cause nfsd4_decode_state_protect4_a()
> to write client-supplied data beyond the end of
> nfsd4_exchange_id.spo_must_allow[] when called by
> nfsd4_decode_exchange_id().
Rewrite the loops so nfsd4_decode_bitmap() cannot iterate beyond
@bmlen.
Reported by: rtm@csail.mit.edu
Fixes: d1c263a031
("NFSD: Replace READ* macros in nfsd4_decode_fattr()")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
This commit is contained in:
parent
80479eb862
commit
c0019b7db1
1 changed files with 2 additions and 5 deletions
|
@ -288,11 +288,8 @@ nfsd4_decode_bitmap4(struct nfsd4_compoundargs *argp, u32 *bmval, u32 bmlen)
|
||||||
p = xdr_inline_decode(argp->xdr, count << 2);
|
p = xdr_inline_decode(argp->xdr, count << 2);
|
||||||
if (!p)
|
if (!p)
|
||||||
return nfserr_bad_xdr;
|
return nfserr_bad_xdr;
|
||||||
i = 0;
|
for (i = 0; i < bmlen; i++)
|
||||||
while (i < count)
|
bmval[i] = (i < count) ? be32_to_cpup(p++) : 0;
|
||||||
bmval[i++] = be32_to_cpup(p++);
|
|
||||||
while (i < bmlen)
|
|
||||||
bmval[i++] = 0;
|
|
||||||
|
|
||||||
return nfs_ok;
|
return nfs_ok;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue