Skip to content

Commit 4e61b39

Browse files
Dan Carpentermehmetb0
Dan Carpenter
authored andcommitted
SUNRPC: Fix integer overflow in decode_rc_list()
BugLink: https://bugs.launchpad.net/bugs/2086242 [ Upstream commit 6dbf1f341b6b35bcc20ff95b6b315e509f6c5369 ] 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: 4aece6a ("nfs41: cb_sequence xdr implementation") Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Anna Schumaker <[email protected]> Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Koichiro Den <[email protected]> Signed-off-by: Roxana Nicolescu <[email protected]>
1 parent 72f1e1f commit 4e61b39

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fs/nfs/callback_xdr.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,8 @@ static __be32 decode_rc_list(struct xdr_stream *xdr,
372372

373373
rc_list->rcl_nrefcalls = ntohl(*p++);
374374
if (rc_list->rcl_nrefcalls) {
375+
if (unlikely(rc_list->rcl_nrefcalls > xdr->buf->len))
376+
goto out;
375377
p = xdr_inline_decode(xdr,
376378
rc_list->rcl_nrefcalls * 2 * sizeof(uint32_t));
377379
if (unlikely(p == NULL))

0 commit comments

Comments
 (0)