Commit 504b273b authored by june li's avatar june li Committed by Jukka Rissanen
Browse files

net: tcp: Do buf ref when resending a segment



We need to check whether buf_sent was true when resending the TCP
segment, and do a buf ref if needed. If this is not done, the buf
will be unref after send, which will cause unpredictable results.

Change-Id: Ibd4490305de88ac6ffd04ec42bba196e57da5c10
Signed-off-by: default avatarjune li <junelizh@foxmail.com>
parent 7ce82fea
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -831,8 +831,11 @@ void net_tcp_ack_received(struct net_context *ctx, uint32_t ack)

			SYS_SLIST_FOR_EACH_CONTAINER(&ctx->tcp->sent_list, buf,
						     sent_list) {
				if (net_nbuf_buf_sent(buf)) {
					do_ref_if_needed(buf);
					net_nbuf_set_buf_sent(buf, false);
				}
			}

			net_tcp_send_data(ctx);
		}