Skip to content

Commit 28bc026

Browse files
Dan Carpentergregkh
authored andcommitted
usb: gadget: rndis: prevent integer overflow in rndis_set_response()
commit 65f3324 upstream. If "BufOffset" is very large the "BufOffset + 8" operation can have an integer overflow. Cc: stable@kernel.org Fixes: 38ea1ea ("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>
1 parent 2c010c6 commit 28bc026

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

drivers/usb/gadget/function/rndis.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,7 @@ static int rndis_set_response(struct rndis_params *params,
640640
BufLength = le32_to_cpu(buf->InformationBufferLength);
641641
BufOffset = le32_to_cpu(buf->InformationBufferOffset);
642642
if ((BufLength > RNDIS_MAX_TOTAL_SIZE) ||
643+
(BufOffset > RNDIS_MAX_TOTAL_SIZE) ||
643644
(BufOffset + 8 >= RNDIS_MAX_TOTAL_SIZE))
644645
return -EINVAL;
645646

0 commit comments

Comments
 (0)