Skip to content

Commit 429fa68

Browse files
ForstPaolo Abeni
authored andcommitted
usbnet: ipheth: check that DPE points past NCM header
By definition, a DPE points at the start of a network frame/datagram. Thus it makes no sense for it to point at anything that's part of the NCM header. It is not a security issue, but merely an indication of a malformed DPE. Enforce that all DPEs point at the data portion of the URB, past the NCM header. Fixes: a2d274c ("usbnet: ipheth: add CDC NCM support") Cc: [email protected] Signed-off-by: Foster Snowhill <[email protected]> Reviewed-by: Jakub Kicinski <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
1 parent c219427 commit 429fa68

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/net/usb/ipheth.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,8 @@ static int ipheth_rcvbulk_callback_ncm(struct urb *urb)
242242
dpe = ncm0->dpe16;
243243
while (le16_to_cpu(dpe->wDatagramIndex) != 0 &&
244244
le16_to_cpu(dpe->wDatagramLength) != 0) {
245-
if (le16_to_cpu(dpe->wDatagramIndex) >= urb->actual_length ||
245+
if (le16_to_cpu(dpe->wDatagramIndex) < IPHETH_NCM_HEADER_SIZE ||
246+
le16_to_cpu(dpe->wDatagramIndex) >= urb->actual_length ||
246247
le16_to_cpu(dpe->wDatagramLength) > urb->actual_length -
247248
le16_to_cpu(dpe->wDatagramIndex)) {
248249
dev->net->stats.rx_length_errors++;

0 commit comments

Comments
 (0)