Skip to content

tcp: fix tcp_poll() races

Eric Dumazet netdev 2 versions – Applied

Status from this message: This series was applied to netdev/net-next.git (main)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest4 patches 4 repliesApplied 4/4
  2. v14 patches 13 repliesSuperseded

Patches in v2 All 4 applied

#Subject and filesSizeRepliesApplied
1/4tcp: add tcp_done_with_error() helperinclude/net/tcp.h net/ipv4/tcp.c net/ipv4/tcp_input.c+23 -121 replyApplied
2/4tcp: fix race in tcp_write_err()net/ipv4/tcp_timer.c+1 -51 replyApplied
3/4tcp: fix races in tcp_abort()net/ipv4/tcp.c+1 -51 replyApplied
4/4tcp: fix races in tcp_v[46]_err()net/ipv4/tcp_ipv4.c net/ipv6/tcp_ipv6.c+6 -151 replyApplied

Reviews trailers per patch

All 4 patches have a Reviewed-by or Acked-by.

PatchNeal Cardwell
1/4A-b
2/4A-b
3/4A-b
4/4A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 net-next 0/4] tcp: fix tcp_poll() races

Flakes in packetdrill tests stressing epoll_wait() were root caused to bad ordering in tcp_write_err()

Precisely, we have to call sk_error_report() after tcp_done().

When fixing this issue, we discovered tcp_abort(), tcp_v4_err() and tcp_v6_err() had similar issues.

Since tcp_reset() has the correct ordering, first patch takes part of it and creates tcp_done_with_error() helper.

v2: added @err parameter to tcp_done_with_error()
as suggested by David Laight.

Eric Dumazet (4):
tcp: add tcp_done_with_error() helper
tcp: fix race in tcp_write_err()
tcp: fix races in tcp_abort()
tcp: fix races in tcp_v[46]_err()

 include/net/tcp.h    |  1 +
 net/ipv4/tcp.c       |  8 ++------
 net/ipv4/tcp_input.c | 32 +++++++++++++++++++++-----------
 net/ipv4/tcp_ipv4.c  | 11 +++--------
 net/ipv4/tcp_timer.c |  6 +-----
 net/ipv6/tcp_ipv6.c  | 10 +++-------
 6 files changed, 31 insertions(+), 37 deletions(-)
Signature · 1 line
2.45.1.288.g0e0cd299f1-goog