mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-24 21:54:01 +00:00
net: emaclite: fix handling for IP packets with specific lengths
The maximum length is capped similarly to the emaclite_send function. Avoid integer underflow for values of ip->ip_len < 30, the minimum length of an IP packet is 21 bytes. Signed-off-by: Samuel Obuch <samuel.obuch@codasip.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Link: https://lore.kernel.org/r/20220927112103.155689-3-samuel.obuch@codasip.com Signed-off-by: Michal Simek <michal.simek@amd.com>
This commit is contained in:
parent
3d1700296c
commit
f4cf004d27
1 changed files with 3 additions and 1 deletions
|
@ -517,6 +517,8 @@ try_again:
|
|||
length = ntohs(ip->ip_len);
|
||||
length += ETHER_HDR_SIZE + ETH_FCS_LEN;
|
||||
debug("IP Packet %x\n", length);
|
||||
if (length > PKTSIZE)
|
||||
length = PKTSIZE;
|
||||
break;
|
||||
default:
|
||||
debug("Other Packet\n");
|
||||
|
@ -525,7 +527,7 @@ try_again:
|
|||
}
|
||||
|
||||
/* Read the rest of the packet which is longer then first read */
|
||||
if (length != first_read)
|
||||
if (length > first_read)
|
||||
xemaclite_alignedread(addr + first_read,
|
||||
etherrxbuff + first_read,
|
||||
length - first_read);
|
||||
|
|
Loading…
Reference in a new issue