mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
SUNRPC: Fix integer overflow in decode_rc_list()
[ 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: 4aece6a19c ("nfs41: cb_sequence xdr implementation")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
8ef4af0671
commit
ae315bcc30
@@ -372,6 +372,8 @@ static __be32 decode_rc_list(struct xdr_stream *xdr,
|
|||||||
|
|
||||||
rc_list->rcl_nrefcalls = ntohl(*p++);
|
rc_list->rcl_nrefcalls = ntohl(*p++);
|
||||||
if (rc_list->rcl_nrefcalls) {
|
if (rc_list->rcl_nrefcalls) {
|
||||||
|
if (unlikely(rc_list->rcl_nrefcalls > xdr->buf->len))
|
||||||
|
goto out;
|
||||||
p = xdr_inline_decode(xdr,
|
p = xdr_inline_decode(xdr,
|
||||||
rc_list->rcl_nrefcalls * 2 * sizeof(uint32_t));
|
rc_list->rcl_nrefcalls * 2 * sizeof(uint32_t));
|
||||||
if (unlikely(p == NULL))
|
if (unlikely(p == NULL))
|
||||||
|
|||||||
Reference in New Issue
Block a user