Skip to content

Commit ee591f2

Browse files
ForstPaolo Abeni
authored andcommitted
usbnet: ipheth: fix DPE OoB read
Fix an out-of-bounds DPE read, limit the number of processed DPEs to the amount that fits into the fixed-size NDP16 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 efcbc67 commit ee591f2

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

drivers/net/usb/ipheth.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ static int ipheth_rcvbulk_callback_ncm(struct urb *urb)
246246
goto rx_error;
247247

248248
dpe = ncm0->dpe16;
249-
while (true) {
249+
for (int dpe_i = 0; dpe_i < IPHETH_NDP16_MAX_DPE; ++dpe_i, ++dpe) {
250250
dg_idx = le16_to_cpu(dpe->wDatagramIndex);
251251
dg_len = le16_to_cpu(dpe->wDatagramLength);
252252

@@ -268,8 +268,6 @@ static int ipheth_rcvbulk_callback_ncm(struct urb *urb)
268268
retval = ipheth_consume_skb(buf, dg_len, dev);
269269
if (retval != 0)
270270
return retval;
271-
272-
dpe++;
273271
}
274272

275273
rx_error:

0 commit comments

Comments
 (0)