lkml.org 
[lkml]   [2022]   [Sep]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subject[PATCH v3 net 0/5] tcp/udp: Fix memory leaks and data races around IPV6_ADDRFORM.
Date
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.

Note patch 1 and 5 conflict with these commits in net-next, respectively.

* 24426654ed3a ("bpf: net: Avoid sk_setsockopt() taking sk lock when called from bpf")
* 34704ef024ae ("bpf: net: Change do_tcp_getsockopt() to take the sockptr_t argument")


Changes:
v3:
* 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/20220928002741.64237-1-kuniyu@amazon.com/
* 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/20220927161209.32939-1-kuniyu@amazon.com/


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 +-
net/core/sock.c | 6 ++++--
net/ipv4/af_inet.c | 23 ++++++++++++++++-------
net/ipv4/tcp.c | 10 ++++++----
net/ipv4/udp.c | 8 ++++++--
net/ipv6/af_inet6.c | 15 ++++++++++++++-
net/ipv6/ipv6_sockglue.c | 34 +++++++++++++++++++---------------
net/ipv6/tcp_ipv6.c | 6 ++++--
net/ipv6/udp.c | 15 ++++++++++++++-
10 files changed, 86 insertions(+), 35 deletions(-)

--
2.30.2

\
 
 \ /
  Last update: 2022-09-29 03:26    [W:0.037 / U:1.340 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site