summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFoster Snowhill <forst@pen.gy>2025-01-26 02:54:08 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-02-17 12:05:16 +0300
commit5835bf66c50ac2b85ed28b282c2456c3516ef0a6 (patch)
tree9278e46e290a2290b97fee3c7f3f1cf4f94e57cf
parentc0912ae6586e61d6b83755aed681c56f41eb33dd (diff)
downloadlinux-5835bf66c50ac2b85ed28b282c2456c3516ef0a6.tar.xz
usbnet: ipheth: fix DPE OoB read
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@vger.kernel.org Signed-off-by: Foster Snowhill <forst@pen.gy> Reviewed-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/net/usb/ipheth.c4
1 files changed, 1 insertions, 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: