linux/net
Paolo Abeni a0eea5f10e mptcp: fix memory leak on address flush
The endpoint cleanup path is prone to a memory leak, as reported
by syzkaller:

 BUG: memory leak
 unreferenced object 0xffff88810680ea00 (size 64):
   comm "syz-executor.6", pid 6191, jiffies 4295756280 (age 24.138s)
   hex dump (first 32 bytes):
     58 75 7d 3c 80 88 ff ff 22 01 00 00 00 00 ad de  Xu}<....".......
     01 00 02 00 00 00 00 00 ac 1e 00 07 00 00 00 00  ................
   backtrace:
     [<0000000072a9f72a>] kmalloc include/linux/slab.h:591 [inline]
     [<0000000072a9f72a>] mptcp_nl_cmd_add_addr+0x287/0x9f0 net/mptcp/pm_netlink.c:1170
     [<00000000f6e931bf>] genl_family_rcv_msg_doit.isra.0+0x225/0x340 net/netlink/genetlink.c:731
     [<00000000f1504a2c>] genl_family_rcv_msg net/netlink/genetlink.c:775 [inline]
     [<00000000f1504a2c>] genl_rcv_msg+0x341/0x5b0 net/netlink/genetlink.c:792
     [<0000000097e76f6a>] netlink_rcv_skb+0x148/0x430 net/netlink/af_netlink.c:2504
     [<00000000ceefa2b8>] genl_rcv+0x24/0x40 net/netlink/genetlink.c:803
     [<000000008ff91aec>] netlink_unicast_kernel net/netlink/af_netlink.c:1314 [inline]
     [<000000008ff91aec>] netlink_unicast+0x537/0x750 net/netlink/af_netlink.c:1340
     [<0000000041682c35>] netlink_sendmsg+0x846/0xd80 net/netlink/af_netlink.c:1929
     [<00000000df3aa8e7>] sock_sendmsg_nosec net/socket.c:704 [inline]
     [<00000000df3aa8e7>] sock_sendmsg+0x14e/0x190 net/socket.c:724
     [<000000002154c54c>] ____sys_sendmsg+0x709/0x870 net/socket.c:2403
     [<000000001aab01d7>] ___sys_sendmsg+0xff/0x170 net/socket.c:2457
     [<00000000fa3b1446>] __sys_sendmsg+0xe5/0x1b0 net/socket.c:2486
     [<00000000db2ee9c7>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
     [<00000000db2ee9c7>] do_syscall_64+0x38/0x90 arch/x86/entry/common.c:80
     [<000000005873517d>] entry_SYSCALL_64_after_hwframe+0x44/0xae

We should not require an allocation to cleanup stuff.

Rework the code a bit so that the additional RCU work is no more needed.

Fixes: 1729cf186d ("mptcp: create the listening socket for new port")
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2021-08-19 12:16:54 +01:00
..
6lowpan
9p
802
8021q
appletalk
atm
ax25
batman-adv
bluetooth Bluetooth: defer cleanup of resources in hci_unregister_dev() 2021-08-05 12:15:24 -07:00
bpf bpf: Add missing bpf_read_[un]lock_trace() for syscall program 2021-08-10 10:10:49 +02:00
bpfilter
bridge net: bridge: fix memleak in br_add_if() 2021-08-10 13:25:14 -07:00
caif
can
ceph
core net: linkwatch: fix failure to restore device state across suspend/resume 2021-08-11 14:43:16 -07:00
dcb
dccp dccp: add do-while-0 stubs for dccp_pr_debug macros 2021-08-09 10:00:02 +01:00
decnet
dns_resolver
dsa net: switchdev: zero-initialize struct switchdev_notifier_fdb_info emitted by drivers towards the bridge 2021-08-10 13:22:57 -07:00
ethernet
ethtool
hsr
ieee802154 net: Fix memory leak in ieee802154_raw_deliver 2021-08-10 12:18:10 +02:00
ife
ipv4 net: igmp: increase size of mr_ifc_count 2021-08-11 15:54:10 -07:00
ipv6
iucv
kcm
key
l2tp
l3mdev
lapb
llc
mac80211 mac80211: fix locking in ieee80211_restart_work() 2021-08-17 06:51:43 -07:00
mac802154
mpls
mptcp mptcp: fix memory leak on address flush 2021-08-19 12:16:54 +01:00
ncsi
netfilter netfilter: nfnetlink_hook: translate inet ingress to netdev 2021-08-06 17:07:41 +02:00
netlabel
netlink
netrom
nfc
nsh
openvswitch ovs: clear skb->tstamp in forwarding path 2021-08-18 11:31:13 +01:00
packet
phonet
psample
qrtr net: really fix the build... 2021-08-03 11:14:03 +01:00
rds net/rds: dma_map_sg is entitled to merge entries 2021-08-18 15:35:50 -07:00
rfkill
rose
rxrpc
sched sch_cake: fix srchost/dsthost hashing mode 2021-08-18 10:14:00 +01:00
sctp sctp: move the active_key update after sh_keys is added 2021-08-03 11:43:43 +01:00
smc net/smc: Correct smc link connection counter in case of smc client 2021-08-09 10:46:59 +01:00
strparser
sunrpc
switchdev
tipc tipc: call tipc_wait_for_connect only when dlen is not 0 2021-08-16 11:20:56 +01:00
tls
unix af_unix: fix garbage collect vs MSG_PEEK 2021-07-28 10:18:00 -07:00
vmw_vsock vsock/virtio: avoid potential deadlock when vsock device remove 2021-08-12 10:57:27 -07:00
wireless
x25
xdp
xfrm Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec 2021-08-04 10:45:41 +01:00
compat.c
devres.c
Kconfig
Makefile
socket.c
sysctl_net.c