[PATCH 1/3] net: tftp: Fix tftp_prev_block counter update
Ramon Fried
rfried.dev at gmail.com
Sun Sep 13 08:40:01 CEST 2020
On Tue, Aug 25, 2020 at 5:27 AM Ley Foon Tan <ley.foon.tan at intel.com> wrote:
>
> Fixes missing update to tftp_prev_block counter before increase
> tftp_cur_block counter when do the tftpput operation.
>
> tftp_prev_block counter is used in update_block_number() function to
> check whether block number (sequence number) is rollover. This bug
> cause the tftpput command fail to upload a large file when block
> number is greater than 16-bit (0xFFFF).
>
> Signed-off-by: Ley Foon Tan <ley.foon.tan at intel.com>
> ---
> net/tftp.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/net/tftp.c b/net/tftp.c
> index c05b7b5532b9..9ca7db256112 100644
> --- a/net/tftp.c
> +++ b/net/tftp.c
> @@ -478,6 +478,7 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip,
> int block = ntohs(*s);
> int ack_ok = (tftp_cur_block == block);
>
> + tftp_prev_block = tftp_cur_block;
> tftp_cur_block = (unsigned short)(block + 1);
> update_block_number();
> if (ack_ok)
> --
> 2.19.0
>
Reviewed-By: Ramon Fried <rfried.dev at gmail.com>
More information about the U-Boot
mailing list