]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
net: wget: fix TCP sequence number wrap around issue
authorYasuharu Shibata <yasuharu.shibata@gmail.com>
Tue, 16 Apr 2024 00:26:24 +0000 (09:26 +0900)
committerTom Rini <trini@konsulko.com>
Tue, 16 Apr 2024 23:19:35 +0000 (17:19 -0600)
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>
net/wget.c

index 71bac92d84d174c1494d2868ab2dac76906c7458..abab371e58edbcbddbf96cabb67af870f420b370 100644 (file)
@@ -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);