diff options
author | 2022-03-15 18:34:06 +0300 | |
---|---|---|
committer | 2022-03-15 12:24:18 -0400 | |
commit | 23a9dbbe0faf124fc4c139615633b9d12a3a89ef (patch) | |
tree | c6e3fd809e3fda06a129d218291a06ba59bc42a6 /include/linux/sunrpc | |
parent | NFSD: prevent underflow in nfssvc_decode_writeargs() (diff) | |
download | linux-23a9dbbe0faf124fc4c139615633b9d12a3a89ef.tar.gz linux-23a9dbbe0faf124fc4c139615633b9d12a3a89ef.tar.bz2 linux-23a9dbbe0faf124fc4c139615633b9d12a3a89ef.zip |
NFSD: prevent integer overflow on 32 bit systems
On a 32 bit system, the "len * sizeof(*p)" operation can have an
integer overflow.
Cc: stable@vger.kernel.org
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Diffstat (limited to 'include/linux/sunrpc')
-rw-r--r-- | include/linux/sunrpc/xdr.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h index b519609af1d0..4417f667c757 100644 --- a/include/linux/sunrpc/xdr.h +++ b/include/linux/sunrpc/xdr.h @@ -731,6 +731,8 @@ xdr_stream_decode_uint32_array(struct xdr_stream *xdr, if (unlikely(xdr_stream_decode_u32(xdr, &len) < 0)) return -EBADMSG; + if (len > SIZE_MAX / sizeof(*p)) + return -EBADMSG; p = xdr_inline_decode(xdr, len * sizeof(*p)); if (unlikely(!p)) return -EBADMSG; |