mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 03:15:31 +09:00
BACKPORT: usb: gadget: rndis: prevent integer overflow in rndis_set_response()
commit65f3324f4bupstream. If "BufOffset" is very large the "BufOffset + 8" operation can have an integer overflow. Bug: 239842288 Cc: stable@kernel.org Fixes:38ea1eac7d("usb: gadget: rndis: check size of RNDIS_MSG_SET command") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/20220301080424.GA17208@kili Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Lee Jones <joneslee@google.com> Change-Id: I4dcecb9ada2680a4211e5ccc9b27de2df964e404
This commit is contained in:
@@ -640,6 +640,7 @@ static int rndis_set_response(struct rndis_params *params,
|
||||
BufLength = le32_to_cpu(buf->InformationBufferLength);
|
||||
BufOffset = le32_to_cpu(buf->InformationBufferOffset);
|
||||
if ((BufLength > RNDIS_MAX_TOTAL_SIZE) ||
|
||||
(BufOffset > RNDIS_MAX_TOTAL_SIZE) ||
|
||||
(BufOffset + 8 >= RNDIS_MAX_TOTAL_SIZE))
|
||||
return -EINVAL;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user