android_kernel_xiaomi_sm7250/include/net
Jason A. Donenfeld a75da5af3b UPSTREAM: wireguard: device: reset peer src endpoint when netns exits
commit 20ae1d6aa159eb91a9bf09ff92ccaa94dbea92c2 upstream.

Each peer's endpoint contains a dst_cache entry that takes a reference
to another netdev. When the containing namespace exits, we take down the
socket and prevent future sockets from being created (by setting
creating_net to NULL), which removes that potential reference on the
netns. However, it doesn't release references to the netns that a netdev
cached in dst_cache might be taking, so the netns still might fail to
exit. Since the socket is gimped anyway, we can simply clear all the
dst_caches (by way of clearing the endpoint src), which will release all
references.

However, the current dst_cache_reset function only releases those
references lazily. But it turns out that all of our usages of
wg_socket_clear_peer_endpoint_src are called from contexts that are not
exactly high-speed or bottle-necked. For example, when there's
connection difficulty, or when userspace is reconfiguring the interface.
And in particular for this patch, when the netns is exiting. So for
those cases, it makes more sense to call dst_release immediately. For
that, we add a small helper function to dst_cache.

This patch also adds a test to netns.sh from Hangbin Liu to ensure this
doesn't regress.

Tested-by: Hangbin Liu <liuhangbin@gmail.com>
Reported-by: Xiumei Mu <xmu@redhat.com>
Cc: Toke Høiland-Jørgensen <toke@redhat.com>
Cc: Paolo Abeni <pabeni@redhat.com>
Fixes: 900575aa33a3 ("wireguard: device: avoid circular netns references")
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
Change-Id: I0ec696b0759919cc59965859882cf814d8fe7a15
2022-11-12 11:22:35 +00:00
..
9p
bluetooth Bluetooth: L2CAP: Fix use-after-free caused by l2cap_chan_put 2022-08-11 12:48:38 +02:00
caif net: caif: add proper error handling 2021-06-10 13:24:06 +02:00
iucv
netfilter netfilter: conntrack: re-fetch conntrack after insertion 2022-06-06 08:24:21 +02:00
netns net: Port samsung MPTCP modifications from SM-N986B 2022-11-12 11:19:58 +00:00
nfc NFC: add NCI_UNREG flag to eliminate the race 2021-12-01 09:27:43 +01:00
phonet
sctp sctp: use call_rcu to free endpoint 2022-01-05 12:34:58 +01:00
tc_act net/sched: act_pedit: really ensure the skb is writable 2022-05-18 09:42:48 +02:00
6lowpan.h
act_api.h
addrconf.h This is the 4.19.139 stable release 2020-08-11 17:03:22 +02:00
af_ieee802154.h
af_rxrpc.h
af_unix.h net: split out functions related to registering inflight socket files 2021-12-14 10:20:10 +05:30
af_vsock.h
ah.h
arp.h ipv4: Invalidate neighbour for broadcast address upon address addition 2022-04-15 14:15:01 +02:00
atmclip.h
ax25.h ax25: fix reference count leaks of ax25_dev 2022-04-27 13:39:45 +02:00
ax88796.h
bond_3ad.h bonding: fix data-races around agg_select_timer 2022-02-23 11:58:39 +01:00
bond_alb.h bonding: make tx_rebalance_counter an atomic 2021-12-14 10:18:05 +01:00
bond_options.h
bonding.h bonding: wait for sysfs kobject destruction before freeing struct slave 2020-12-08 10:18:53 +01:00
busy_poll.h net: Fix a data-race around sysctl_net_busy_poll. 2022-09-05 10:26:30 +02:00
calipso.h
cfg80211-wext.h
cfg80211.h BACKPORT: UPSTREAM: cfg80211: separate get channel number from ies 2022-11-12 11:20:51 +00:00
cfg802154.h
checksum.h openvswitch: Fix setting ipv6 fields causing hw csum failure 2022-03-02 11:38:12 +01:00
cipso_ipv4.h
cls_cgroup.h
cnss2.h cnss2: Add CNSS_BUS_EVENT to report bus info 2021-04-20 10:26:23 +08:00
cnss_nl.h
cnss_prealloc.h
cnss_utils.h
codel_impl.h
codel_qdisc.h
codel.h
compat.h
datalink.h
dcbevent.h
dcbnl.h
devlink.h
dn_dev.h
dn_fib.h
dn_neigh.h
dn_nsp.h
dn_route.h
dn.h
dsa.h net: dsa: read mac address from DT for slave device 2020-11-10 12:36:02 +01:00
dsfield.h
dst_cache.h UPSTREAM: wireguard: device: reset peer src endpoint when netns exits 2022-11-12 11:22:35 +00:00
dst_metadata.h net: fix a memleak when uncloning an skb dst and its metadata 2022-02-16 12:51:46 +01:00
dst_ops.h
dst.h
erspan.h
esp.h esp: limit skb_page_frag_refill use to a single page 2022-07-12 16:29:00 +02:00
ethoc.h
failover.h
fib_notifier.h
fib_rules.h
firewire.h
flow_dissector.h net/sched: flower: fix parsing of ethertype following VLAN header 2022-04-20 09:12:48 +02:00
flow.h
fou.h
fq_impl.h
fq.h
garp.h
gen_stats.h
genetlink.h
geneve.h
gre.h
gro_cells.h
gtp.h
gue.h
hwbm.h
icmp.h net: icmp: pass zeroed opts from icmp{,v6}_ndo_send before sending 2021-03-04 09:39:59 +01:00
ieee80211_radiotap.h
ieee802154_netdev.h net: ieee802154: return -EINVAL for unknown addr type 2022-10-26 13:19:42 +02:00
if_inet6.h ipv6: fix locking issues with loops over idev->addr_list 2022-06-14 16:59:14 +02:00
ife.h
ila.h
inet6_connection_sock.h
inet6_hashtables.h
inet_common.h net: Port samsung MPTCP modifications from SM-N986B 2022-11-12 11:19:58 +00:00
inet_connection_sock.h net: Port samsung MPTCP modifications from SM-N986B 2022-11-12 11:19:58 +00:00
inet_ecn.h
inet_frag.h
inet_hashtables.h secure_seq: use the 64 bits of the siphash for port offset calculation 2022-06-06 08:24:20 +02:00
inet_sock.h net: Port samsung MPTCP modifications from SM-N986B 2022-11-12 11:19:58 +00:00
inet_timewait_sock.h
inetpeer.h
ip6_checksum.h
ip6_fib.h ipv6: annotate accesses to fn->fn_sernum 2022-02-08 18:23:09 +01:00
ip6_route.h net: ipv6: fix returned variable type in ip6_skb_dst_mtu 2021-08-12 13:19:39 +02:00
ip6_tunnel.h
ip_fib.h
ip_tunnels.h This is the 4.19.160 stable release 2020-11-24 14:57:17 +01:00
ip_vs.h ipvs: allow connection reuse for unconfirmed conntrack 2020-08-19 08:14:56 +02:00
ip.h Merge remote-tracking branch 'aosp/android-4.19-stable' into android12-base 2022-08-03 19:42:38 +05:30
ipcomp.h
ipconfig.h
ipv6_frag.h
ipv6.h Merge android-4.19-stable.125 (a483478) into msm-4.19 2020-09-20 23:45:10 +05:30
ipx.h
iw_handler.h
kcm.h
l3mdev.h
lag.h
lapb.h
lib80211.h
llc_c_ac.h
llc_c_ev.h
llc_c_st.h
llc_conn.h
llc_if.h
llc_pdu.h net: llc: fix skb_over_panic 2021-08-04 12:23:46 +02:00
llc_s_ac.h
llc_s_ev.h
llc_s_st.h
llc_sap.h
llc.h llc: fix out-of-bound array index in llc_sk_dev_hash() 2021-11-26 11:36:16 +01:00
lwtunnel.h
mac80211.h
mac802154.h
mip6.h
mld.h
mpls_iptunnel.h
mpls.h
mptcp_v4.h net: Port samsung MPTCP modifications from SM-N986B 2022-11-12 11:19:58 +00:00
mptcp_v6.h net: Port samsung MPTCP modifications from SM-N986B 2022-11-12 11:19:58 +00:00
mptcp.h net: Port samsung MPTCP modifications from SM-N986B 2022-11-12 11:19:58 +00:00
mrp.h
ncsi.h
ndisc.h UPSTREAM: ipv6: ndisc: RFC-ietf-6man-ra-pref64-09 is now published as RFC8781 2020-11-16 07:43:08 +01:00
neighbour.h
net_failover.h
net_namespace.h net: Port samsung MPTCP modifications from SM-N986B 2022-11-12 11:19:58 +00:00
net_ratelimit.h
netevent.h
netlabel.h
netlink.h netlink: add ethernet address policy types 2020-11-16 22:56:00 -08:00
netprio_cgroup.h
netrom.h
nexthop.h
nl802154.h net: ieee802154: handle iftypes as u32 2021-12-01 09:27:42 +01:00
nsh.h
p8022.h
page_pool.h
ping.h
pkt_cls.h
pkt_sched.h Merge tag 'ASB-2022-01-05_4.19-stable' of https://github.com/aosp-mirror/kernel_common into android12-base 2022-02-26 20:18:58 +05:30
pptp.h
protocol.h
psample.h psample: Add a fwd declaration for skbuff 2021-08-26 08:36:38 -04:00
psnap.h
raw.h
rawv6.h
red.h sch_red: fix off-by-one checks in red_check_params() 2021-04-14 08:22:34 +02:00
regulatory.h
request_sock.h
rmnet_config.h
rose.h
route.h
rsi_91x.h
rtnetlink.h Revert "can: dev: Move device back to init netns on owning netns delete" 2021-04-07 11:44:51 +02:00
sch_generic.h Merge 4.19.226 into android-4.19-stable 2022-02-01 10:03:27 +01:00
scm.h
secure_seq.h secure_seq: use the 64 bits of the siphash for port offset calculation 2022-06-06 08:24:20 +02:00
seg6_hmac.h
seg6_local.h
seg6.h
slhc_vj.h
smc.h
snmp.h
sock_reuseport.h
sock.h net: Port samsung MPTCP modifications from SM-N986B 2022-11-12 11:19:58 +00:00
Space.h
stp.h
strparser.h
switchdev.h
tcp_states.h net: Port samsung MPTCP modifications from SM-N986B 2022-11-12 11:19:58 +00:00
tcp.h net: Port samsung MPTCP modifications from SM-N986B 2022-11-12 11:19:58 +00:00
timewait_sock.h
tipc.h
tls.h net/tls: Protect from calling tls_dev_del for TLS RX twice 2020-12-08 10:18:52 +01:00
transp_v6.h net: Port samsung MPTCP modifications from SM-N986B 2022-11-12 11:19:58 +00:00
tso.h
tun_proto.h
udp_tunnel.h
udp.h
udplite.h
virt_wifi.h
vsock_addr.h
vxlan.h
wext.h
wimax.h
x25.h
x25device.h
xdp_sock.h
xdp.h
xfrm.h This is the 4.19.238 stable release 2022-04-18 09:57:50 +02:00