diff mbox series

[v2] net: wget: fix TCP sequence number wrap around issue

Message ID 20240416002624.1909-1-yasuharu.shibata@gmail.com
State Accepted
Commit beac9581531d7882df8c1de653db18fb3ab4100a
Delegated to: Tom Rini
Headers show
Series [v2] net: wget: fix TCP sequence number wrap around issue | expand

Commit Message

Yasuharu Shibata April 16, 2024, 12:26 a.m. UTC
If tcp_seq_num is wrap around, tcp_seq_num >= initial_data_seq_num
isn't satisfied and store_block() isn't called.
The condition has a wrap around issue, so it is fixed in this patch.

Signed-off-by: Yasuharu Shibata <yasuharu.shibata@gmail.com>
Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com>
Suggested-by: Michael Trimarchi <michael@amarulasolutions.com>
Reported-by: Tim Harvey <tharvey@gateworks.com>
Tested-by: Fabio Estevam <festevam@denx.de>
---
v1 -> v2:
- Add tags in commit message
- Link to v1: https://lore.kernel.org/u-boot/20240415130013.26721-1-yasuharu.shibata@gmail.com/
---
 net/wget.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Tom Rini April 17, 2024, 12:28 a.m. UTC | #1
On Tue, 16 Apr 2024 09:26:24 +0900, Yasuharu Shibata wrote:

> If tcp_seq_num is wrap around, tcp_seq_num >= initial_data_seq_num
> isn't satisfied and store_block() isn't called.
> The condition has a wrap around issue, so it is fixed in this patch.
> 
> 

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/net/wget.c b/net/wget.c
index 71bac92d84..abab371e58 100644
--- a/net/wget.c
+++ b/net/wget.c
@@ -404,9 +404,7 @@  static void wget_handler(uchar *pkt, u16 dport,
 		}
 		next_data_seq_num = tcp_seq_num + len;
 
-		if (tcp_seq_num >= initial_data_seq_num &&
-		    store_block(pkt, tcp_seq_num - initial_data_seq_num,
-				len) != 0) {
+		if (store_block(pkt, tcp_seq_num - initial_data_seq_num, len) != 0) {
 			wget_fail("wget: store error\n",
 				  tcp_seq_num, tcp_ack_num, action);
 			net_set_state(NETLOOP_FAIL);