summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2022-03-15 18:34:06 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-04-15 14:17:59 +0200
commitce1aa09cc14ed625104acc2d487bd92b9a88efe2 (patch)
tree4dd27b01ba5349a6a7c8e0e516cd09aa1dfcbd72 /include
parent85259340fc9bd54e3d567b41b881ecb4d0055da1 (diff)
NFSD: prevent integer overflow on 32 bit systems
commit 23a9dbbe0faf124fc4c139615633b9d12a3a89ef upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/sunrpc/xdr.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h
index a8d68c5a4ca6..fb0a6d6c91e4 100644
--- a/include/linux/sunrpc/xdr.h
+++ b/include/linux/sunrpc/xdr.h
@@ -536,6 +536,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;