]> www.infradead.org Git - users/hch/misc.git/commit
usbnet: ipheth: refactor NCM datagram loop
authorFoster Snowhill <forst@pen.gy>
Sat, 25 Jan 2025 23:54:06 +0000 (00:54 +0100)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 28 Jan 2025 11:16:32 +0000 (12:16 +0100)
commit2a9a196429e98fcc64078366c2679bc40aba5466
tree3dd4120166fecc8d733f92e99fb0e54945ec8aaf
parent86586dcb75cb8fd062a518aca8ee667938b91efb
usbnet: ipheth: refactor NCM datagram loop

Introduce an rx_error label to reduce repetitions in the header
signature checks.

Store wDatagramIndex and wDatagramLength after endianness conversion to
avoid repeated le16_to_cpu() calls.

Rewrite the loop to return on a null trailing DPE, which is required
by the CDC NCM spec. In case it is missing, fall through to rx_error.

This change does not fix any particular issue. Its purpose is to
simplify a subsequent commit that fixes a potential OoB read by limiting
the maximum amount of processed DPEs.

Cc: stable@vger.kernel.org # 6.5.x
Signed-off-by: Foster Snowhill <forst@pen.gy>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/usb/ipheth.c