Skip to content

Commit 07c3c12

Browse files
Dan Carpentergregkh
Dan Carpenter
authored andcommitted
SUNRPC: Fix integer overflow in decode_rc_list()
[ Upstream commit 6dbf1f3 ] 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]>
1 parent 21f5e73 commit 07c3c12

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fs/nfs/callback_xdr.c

+2
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,8 @@ static __be32 decode_rc_list(struct xdr_stream *xdr,
375375

376376
rc_list->rcl_nrefcalls = ntohl(*p++);
377377
if (rc_list->rcl_nrefcalls) {
378+
if (unlikely(rc_list->rcl_nrefcalls > xdr->buf->len))
379+
goto out;
378380
p = xdr_inline_decode(xdr,
379381
rc_list->rcl_nrefcalls * 2 * sizeof(uint32_t));
380382
if (unlikely(p == NULL))

0 commit comments

Comments
 (0)