From 2dddc1bb296308b48f89f31e711965fa2c8091a0 Mon Sep 17 00:00:00 2001 From: Ramon Fried Date: Wed, 3 Feb 2021 21:28:59 +0200 Subject: [PATCH] net: tftp: Avoid sending extra ack on completion in tftpboot, if ack was already sent previously for this packet, don't send again. Fixes: cc6b87ecaa96 ("net: tftp: Add client support for RFC 7440") Reported-by: Suneel Garapati Signed-off-by: Ramon Fried Tested-by: Suneel Garapati Tested-by: Oliver Graute --- net/tftp.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/net/tftp.c b/net/tftp.c index d8cb12120b..00ab7ca0b3 100644 --- a/net/tftp.c +++ b/net/tftp.c @@ -669,6 +669,12 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip, break; } + if (len < tftp_block_size) { + tftp_send(); + tftp_complete(); + break; + } + /* * Acknowledge the block just received, which will prompt * the remote for the next one. @@ -677,11 +683,6 @@ static void tftp_handler(uchar *pkt, unsigned dest, struct in_addr sip, tftp_send(); tftp_next_ack += tftp_windowsize; } - - if (len < tftp_block_size) { - tftp_send(); - tftp_complete(); - } break; case TFTP_ERROR: -- 2.39.5