]> www.infradead.org Git - users/jedix/linux-maple.git/commit
nfsd4: fix bad bounds checking
authorJ. Bruce Fields <bfields@redhat.com>
Tue, 1 Mar 2016 01:21:21 +0000 (20:21 -0500)
committerChuck Anderson <chuck.anderson@oracle.com>
Thu, 26 May 2016 22:46:12 +0000 (15:46 -0700)
commit7d85d507c76cb9c874d4f598594358ed91722086
tree4d0a1e3991b36020b7512482fc7b4c2d33201386
parent2cef2086e416885605f5808d4a4b90d74544a199
nfsd4: fix bad bounds checking

Orabug: 23331077

[ Upstream commit 4aed9c46afb80164401143aa0fdcfe3798baa9d5 ]

A number of spots in the xdr decoding follow a pattern like

n = be32_to_cpup(p++);
READ_BUF(n + 4);

where n is a u32.  The only bounds checking is done in READ_BUF itself,
but since it's checking (n + 4), it won't catch cases where n is very
large, (u32)(-4) or higher.  I'm not sure exactly what the consequences
are, but we've seen crashes soon after.

Instead, just break these up into two READ_BUF()s.

Cc: stable@vger.kernel.org
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
(cherry picked from commit d876f71611ad9b720cc890075b3c4bec25bd54b5)

Signed-off-by: Dan Duval <dan.duval@oracle.com>
fs/nfsd/nfs4xdr.c