Skip to content

Commit

Permalink
net: tcp: Do not mark TCP segment not sent in net_if
Browse files Browse the repository at this point in the history
If the TCP segment is not sent properly by L2, then do not mark
it "not sent" in net_if.c:net_if_tx(). That "not sent" marking
confused TCP ref counting in tcp.c:tcp_retry_expired() and caused
the packet to be freed too early which then caused free net_buf
access issue during packet resend. This free memory access was
seen with zperf sample application.

From TCP point of view, the packet can be considered sent when
it is given to L2. The TCP timer will resend the packet if needed.

Fixes #15050

Signed-off-by: Jukka Rissanen <[email protected]>
  • Loading branch information
jukkar authored and nashif committed Apr 1, 2019
1 parent 30d3193 commit 1eead93
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions subsys/net/ip/net_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,6 @@ static bool net_if_tx(struct net_if *iface, struct net_pkt *pkt)
}

if (status < 0) {
if (IS_ENABLED(CONFIG_NET_TCP)
&& net_pkt_family(pkt) != AF_UNSPEC) {
net_pkt_set_sent(pkt, false);
}

net_pkt_unref(pkt);
} else {
net_stats_update_bytes_sent(iface, status);
Expand Down

0 comments on commit 1eead93

Please sign in to comment.