From: Foster Snowhill <forst@xxxxxx> commit ee591f2b281721171896117f9946fced31441418 upstream. 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: a2d274c62e44 ("usbnet: ipheth: add CDC NCM support") Cc: stable@xxxxxxxxxxxxxxx Signed-off-by: Foster Snowhill <forst@xxxxxx> Reviewed-by: Jakub Kicinski <kuba@xxxxxxxxxx> Signed-off-by: Paolo Abeni <pabeni@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/net/usb/ipheth.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/net/usb/ipheth.c b/drivers/net/usb/ipheth.c index 03249208612e..5347cd7e295b 100644 --- a/drivers/net/usb/ipheth.c +++ b/drivers/net/usb/ipheth.c @@ -246,7 +246,7 @@ static int ipheth_rcvbulk_callback_ncm(struct urb *urb) goto rx_error; dpe = ncm0->dpe16; - while (true) { + for (int dpe_i = 0; dpe_i < IPHETH_NDP16_MAX_DPE; ++dpe_i, ++dpe) { dg_idx = le16_to_cpu(dpe->wDatagramIndex); dg_len = le16_to_cpu(dpe->wDatagramLength); @@ -268,8 +268,6 @@ static int ipheth_rcvbulk_callback_ncm(struct urb *urb) retval = ipheth_consume_skb(buf, dg_len, dev); if (retval != 0) return retval; - - dpe++; } rx_error: -- 2.48.1 Patches currently in stable-queue which might be from forst@xxxxxx are queue-6.6/usbnet-ipheth-use-static-ndp16-location-in-urb.patch queue-6.6/usbnet-ipheth-check-that-dpe-points-past-ncm-header.patch queue-6.6/usbnet-ipheth-fix-dpe-oob-read.patch queue-6.6/usbnet-ipheth-document-scope-of-ncm-implementation.patch queue-6.6/usbnet-ipheth-fix-possible-overflow-in-dpe-length-check.patch queue-6.6/usbnet-ipheth-refactor-ncm-datagram-loop.patch queue-6.6/usbnet-ipheth-break-up-ncm-header-size-computation.patch