Skip to content

tcp/udp: Fix memory leaks and data races around IPV6_ADDRFORM.

Kuniyuki Iwashima lkml netdev 6 versions – Applied

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

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest5 patches 1 replyApplied 5/5
  2. v45 patches 2 repliesSuperseded
  3. v3 posting 2/25 patches 2 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v3 posting 1/25 patches0 repliesSuperseded
v25 patches6 repliesSuperseded
v15 patches8 repliesSuperseded

Changes in v5 from the cover letter

* Patch 1 & 5
* Rebase and resolve conflicts with 24426654ed3a and 34704ef024ae

* Patch 3:
* Remove 'inline' from udplite_sk_init()
* Remove EXPORT_SYMBOL_GPL(inet6_sock_destruct)

Patches in v5 All 5 applied

#Subject and filesSizeRepliesApplied
1/5tcp/udp: Fix memory leak in ipv6_renew_options().net/ipv6/ipv6_sockglue.c+7 -00 repliesApplied
2/5udp: Call inet6_destroy_sock() in setsockopt(IPV6_ADDRFORM).include/net/ipv6.h net/ipv6/af_inet6.c net/ipv6/ipv6_sockglue.c+15 -121 replyApplied
3/5tcp/udp: Call inet6_destroy_sock() in IPv6 sk->sk_destruct().include/net/ipv6.h include/net/udp.h include/net/udplite.h +6 more+46 -150 repliesApplied
4/5ipv6: Fix data races around sk->sk_prot.net/core/sock.c net/ipv4/af_inet.c net/ipv6/ipv6_sockglue.c+22 -110 repliesApplied
5/5tcp: Fix data races around icsk->icsk_af_ops.net/ipv4/tcp.c net/ipv6/ipv6_sockglue.c net/ipv6/tcp_ipv6.c+12 -70 repliesApplied

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v5 yet.

Read the v5 thread

Cover letter [PATCH v5 net 0/5] tcp/udp: Fix memory leaks and data races around IPV6_ADDRFORM.

This series fixes some memory leaks and data races caused in the same scenario where one thread converts an IPv6 socket into IPv4 with IPV6_ADDRFORM and another accesses the socket concurrently.

Changes:
v5:
* Patch 1 & 5
* Rebase and resolve conflicts with 24426654ed3a and 34704ef024ae

* Patch 3:
* Remove 'inline' from udplite_sk_init()
* Remove EXPORT_SYMBOL_GPL(inet6_sock_destruct)

v4: https://lore.kernel.org/netdev/[email protected]/
* Patch 3:
* Change UDPv6 Lite's sk->sk_prot->init() and sk->destruct() as well.
* Move udplite_sk_init() from udplite.h to udplite.c.

v3 (Resend): https://lore.kernel.org/netdev/[email protected]/
* CC blamed commits' EHOSTUNREACH authors to make patchwork happy

v3: https://lore.kernel.org/netdev/[email protected]/
* Patch 2:
* Add comment for np->rxopt.all = 0
* Add inet6_cleanup_sock()
* Patch 3:
* Call inet6_cleanup_sock() instead of inet6_destroy_sock()

v2: https://lore.kernel.org/netdev/[email protected]/
* Patch 3:
* Move inet6_destroy_sock() from sk_prot->destroy()
to sk->sk_destruct() and fix CONFIG_IPV6=m build failure
* Patch 5:
* Add WRITE_ONCE()s in tcp_v6_connect()
* Add Reported-by tags and KCSAN log in changelog

v1: https://lore.kernel.org/netdev/[email protected]/

Kuniyuki Iwashima (5):
tcp/udp: Fix memory leak in ipv6_renew_options().
udp: Call inet6_destroy_sock() in setsockopt(IPV6_ADDRFORM). tcp/udp: Call inet6_destroy_sock() in IPv6 sk->sk_destruct().
ipv6: Fix data races around sk->sk_prot.
tcp: Fix data races around icsk->icsk_af_ops.

 include/net/ipv6.h       |  2 ++
 include/net/udp.h        |  2 +-
 include/net/udplite.h    |  8 --------
 net/core/sock.c          |  6 ++++--
 net/ipv4/af_inet.c       | 23 ++++++++++++++++-------
 net/ipv4/tcp.c           | 10 ++++++----
 net/ipv4/udp.c           |  9 ++++++---
 net/ipv4/udplite.c       |  8 ++++++++
 net/ipv6/af_inet6.c      | 14 +++++++++++++-
 net/ipv6/ipv6_sockglue.c | 34 +++++++++++++++++++---------------
 net/ipv6/tcp_ipv6.c      |  6 ++++--
 net/ipv6/udp.c           | 15 ++++++++++++++-
 net/ipv6/udp_impl.h      |  1 +
 net/ipv6/udplite.c       |  9 ++++++++-
 14 files changed, 102 insertions(+), 45 deletions(-)
Signature · 1 line
2.30.2