Skip to content

inet: frags: avoid possible races at netns dismantle

Eric Dumazet netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest11 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11inet: rename netns_frags to fqdirinclude/net/inet_frag.h include/net/netns/ieee802154_6lowpan.h include/net/netns/ipv4.h +6 more+61 -600 replies
2/11net: rename inet_frags_exit_net() to fqdir_exit()include/net/inet_frag.h net/ieee802154/6lowpan/reassembly.c net/ipv4/inet_fragment.c +3 more+11 -110 replies
3/11net: rename struct fqdir fieldsinclude/net/netns/ieee802154_6lowpan.h include/net/netns/ipv4.h include/net/netns/ipv6.h +6 more+92 -920 replies
4/11ipv4: no longer reference init_net in ip4_frags_ns_ctl_table[]net/ipv4/ip_fragment.c+6 -120 replies
5/11ipv6: no longer reference init_net in ip6_frags_ns_ctl_table[]net/ipv6/reassembly.c+5 -100 replies
6/11netfilter: ipv6: nf_defrag: no longer reference init_net in nf_ct_frag6_sysctl_tablenet/ipv6/netfilter/nf_conntrack_reasm.c+7 -120 replies
7/11ieee820154: 6lowpan: no longer reference init_net in lowpan_frags_ns_ctl_tablenet/ieee802154/6lowpan/reassembly.c+6 -110 replies
8/11net: rename inet_frags_init_net() to fdir_init()include/net/inet_frag.h net/ieee802154/6lowpan/reassembly.c net/ipv4/ip_fragment.c +2 more+6 -90 replies
9/11net: add a net pointer to struct fqdirinclude/net/inet_frag.h net/ieee802154/6lowpan/reassembly.c net/ipv4/ip_fragment.c +2 more+17 -240 replies
10/11net: dynamically allocate fqdir structuresinclude/net/inet_frag.h include/net/netns/ieee802154_6lowpan.h include/net/netns/ipv4.h +8 more+78 -630 replies
11/11inet: frags: rework rhashtable dismantleinclude/net/inet_frag.h net/ipv4/inet_fragment.c+41 -1215 replies

Reviews trailers per patch

1 of 11 patches has a Reviewed-by or Acked-by.

PatchEric Dumazet
1/11
2/11
3/11
4/11
5/11
6/11
7/11
8/11
9/11
10/11
11/11R-b

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

Read the v1 thread

Cover letter [PATCH net-next 00/11] inet: frags: avoid possible races at netns dismantle

This patch series fixes a race happening on netns dismantle with frag queues. While rhashtable_free_and_destroy() is running, concurrent timers might run inet_frag_kill() and attempt rhashtable_remove_fast() calls. This is not allowed by rhashtable logic.

Since I do not want to add expensive synchronize_rcu() calls in the netns dismantle path, I had to no longer inline netns_frags structures, but dynamically allocate them.

The ten first patches make this preparation, so that the last patch clearly shows the fix.

As this patch series is not exactly trivial, I chose to target 5.3. We will backport it once soaked a bit.

Eric Dumazet (11):
inet: rename netns_frags to fqdir
net: rename inet_frags_exit_net() to fqdir_exit()
net: rename struct fqdir fields
ipv4: no longer reference init_net in ip4_frags_ns_ctl_table[]
ipv6: no longer reference init_net in ip6_frags_ns_ctl_table[]
netfilter: ipv6: nf_defrag: no longer reference init_net in
nf_ct_frag6_sysctl_table
ieee820154: 6lowpan: no longer reference init_net in
lowpan_frags_ns_ctl_table
net: rename inet_frags_init_net() to fdir_init()
net: add a net pointer to struct fqdir
net: dynamically allocate fqdir structures
inet: frags: rework rhashtable dismantle

 include/net/inet_frag.h                 | 48 ++++++++----
 include/net/netns/ieee802154_6lowpan.h  |  2 +-
 include/net/netns/ipv4.h                |  2 +-
 include/net/netns/ipv6.h                |  4 +-
 net/ieee802154/6lowpan/reassembly.c     | 36 ++++-----
 net/ipv4/inet_fragment.c                | 98 ++++++++++++++++---------
 net/ipv4/ip_fragment.c                  | 67 +++++++----------
 net/ipv4/proc.c                         |  4 +-
 net/ipv6/netfilter/nf_conntrack_reasm.c | 43 +++++------
 net/ipv6/proc.c                         |  4 +-
 net/ipv6/reassembly.c                   | 40 ++++------
 11 files changed, 181 insertions(+), 167 deletions(-)
Signature · 1 line
2.22.0.rc1.257.g3120a18244-goog