net: emaclite: Avoid reading negative bytes
Subsystems (2)
PATCH 1/1 net: emaclite: Avoid reading negative bytes
As far as I know, an IP packet isn't necessarily shorter than an ARP packet, and if length < first_read, xemaclite_alignedread() goes into an infinite loop.
--- drivers/net/xilinx_emaclite.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/xilinx_emaclite.c +1 -1
@@ -526,7 +526,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);
Signature · 1 line
2.37.1
Quoted 22 lines · Liao Junxuan
As far as I know, an IP packet isn't necessarily shorter than an ARP packet, and if length <
first_read,xemaclite_alignedread()goes into an infinite loop.--- drivers/net/xilinx_emaclite.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/xilinx_emaclite.c +1
-2@@ -526,7 +526,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); --
Quoted 2 lines
2.37.1
There's a similar patch here.
https://lists.denx.de/pipermail/u-boot/2022-July/488770.html
I let michal review it.
Michal Simek
maintainerQuoted 19 lines · Ramon Fried
CAUTION: This message has originated from an External Source. Please use proper judgment and caution when opening attachments, clicking links, or responding to this email.
Quoted 15 lines · Liao Junxuan
As far as I know, an IP packet isn't necessarily shorter than an ARP packet, and if length <
first_read,xemaclite_alignedread()goes into an infinite loop.--- drivers/net/xilinx_emaclite.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/xilinx_emaclite.c +0
-0@@ -526,7 +526,7 @@ try_again: }
Quoted 12 lines
Quoted 9 lines
drivers/net/xilinx_emaclite.c +1
-2/* 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); --2.37.1
There's a similar patch here.
https://lists.denx.de/pipermail/u-boot/2022-July/488770.html
I let michal review it.
You need to CC me on these patches to see them. The patch from Samuel is better and already reviewed it.
Thanks,
Michal