summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@linaro.org>2024-09-19 10:50:33 +0200
committerAnna Schumaker <anna.schumaker@oracle.com>2024-10-03 22:19:13 +0200
commit6dbf1f341b6b35bcc20ff95b6b315e509f6c5369 (patch)
treee68700cb37b3d3c05dfa1ea5eba6f37ef15d9b71 /fs
parentsunrpc: fix prog selection loop in svc_process_common (diff)
downloadlinux-6dbf1f341b6b35bcc20ff95b6b315e509f6c5369.tar.xz
linux-6dbf1f341b6b35bcc20ff95b6b315e509f6c5369.zip
SUNRPC: Fix integer overflow in decode_rc_list()
The math in "rc_list->rcl_nrefcalls * 2 * sizeof(uint32_t)" could have an integer overflow. Add bounds checking on rc_list->rcl_nrefcalls to fix that. Fixes: 4aece6a19cf7 ("nfs41: cb_sequence xdr implementation") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/callback_xdr.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c
index 6df77f008d3f..fdeb0b34a3d3 100644
--- a/fs/nfs/callback_xdr.c
+++ b/fs/nfs/callback_xdr.c
@@ -375,6 +375,8 @@ static __be32 decode_rc_list(struct xdr_stream *xdr,
rc_list->rcl_nrefcalls = ntohl(*p++);
if (rc_list->rcl_nrefcalls) {
+ if (unlikely(rc_list->rcl_nrefcalls > xdr->buf->len))
+ goto out;
p = xdr_inline_decode(xdr,
rc_list->rcl_nrefcalls * 2 * sizeof(uint32_t));
if (unlikely(p == NULL))