linux-stable/net
Xin Long 2a64aca15c sctp: fix a SCTP_MIB_CURRESTAB leak in sctp_sf_do_dupcook_b
[ Upstream commit f282df0391 ]

Normally SCTP_MIB_CURRESTAB is always incremented once asoc enter into
ESTABLISHED from the state < ESTABLISHED and decremented when the asoc
is being deleted.

However, in sctp_sf_do_dupcook_b(), the asoc's state can be changed to
ESTABLISHED from the state >= ESTABLISHED where it shouldn't increment
SCTP_MIB_CURRESTAB. Otherwise, one asoc may increment MIB_CURRESTAB
multiple times but only decrement once at the end.

I was able to reproduce it by using scapy to do the 4-way shakehands,
after that I replayed the COOKIE-ECHO chunk with 'peer_vtag' field
changed to different values, and SCTP_MIB_CURRESTAB was incremented
multiple times and never went back to 0 even when the asoc was freed.

This patch is to fix it by only incrementing SCTP_MIB_CURRESTAB when
the state < ESTABLISHED in sctp_sf_do_dupcook_b().

Fixes: 1da177e4c3 ("Linux-2.6.12-rc2")
Reported-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-05-22 10:57:38 +02:00
..
6lowpan
9p
802
8021q net: vlan: avoid leaks on register_vlan_dev() failures 2021-01-17 13:58:58 +01:00
appletalk appletalk: Fix skb allocation size in loopback case 2021-04-07 12:47:02 +02:00
atm
ax25
batman-adv batman-adv: initialize "struct batadv_tvlv_tt_vlan_data"->reserved field 2021-04-16 11:57:48 +02:00
bluetooth Bluetooth: check for zapped sk before connecting 2021-05-22 10:57:36 +02:00
bpf
bridge net: bridge: use switchdev for port flags set through sysfs too 2021-03-07 11:27:43 +01:00
caif
can can: af_can: prevent potential access of uninitialized member in canfd_rcv() 2020-11-24 13:05:47 +01:00
ceph
core neighbour: Disregard DEAD dst in neigh_update 2021-04-28 12:08:40 +02:00
dcb net: dcb: Accept RTM_GETDCB messages carrying set-like DCB commands 2021-01-23 15:48:46 +01:00
dccp ipv6: weaken the v4mapped source check 2021-04-07 12:47:00 +02:00
decnet
dns_resolver
dsa
ethernet
hsr hsr: use netdev_err() instead of WARN_ONCE() 2021-05-22 10:57:24 +02:00
ieee802154 net: ieee802154: forbid monitor for add llsec seclevel 2021-04-28 12:08:41 +02:00
ife
ipv4 netfilter: x_tables: fix compat match/target pad out-of-bound write 2021-04-16 11:57:53 +02:00
ipv6 ip6_vti: proper dev_{hold|put} in ndo_[un]init methods 2021-05-22 10:57:36 +02:00
ipx
iucv net/af_iucv: set correct sk_protocol for child sockets 2020-12-08 10:17:32 +01:00
kcm
key af_key: relax availability checks for skb size calculation 2021-02-23 14:00:29 +01:00
l2tp
l3mdev
lapb net: lapb: Copy the skb before sending a packet 2021-02-10 09:12:08 +01:00
llc
mac80211 mac80211: clear the beacon's CRC after channel switch 2021-05-22 10:57:36 +02:00
mac802154 net: mac802154: Fix general protection fault 2021-04-16 11:57:52 +02:00
mpls net: avoid infinite loop in mpls_gso_segment when mpls_hlen == 0 2021-03-17 16:34:28 +01:00
ncsi net/ncsi: Avoid GFP_KERNEL in response handler 2021-04-16 11:57:51 +02:00
netfilter netfilter: nft_limit: avoid possible divide error in nft_limit_init 2021-04-28 12:08:42 +02:00
netlabel cipso,calipso: resolve a number of problems with the DOI refcounts 2021-03-17 16:34:29 +01:00
netlink
netrom
nfc net:nfc:digital: Fix a double free in digital_tg_recv_dep_req 2021-05-22 10:57:34 +02:00
nsh
openvswitch openvswitch: fix stack OOB read while fragmenting IPv4 packets 2021-05-22 10:57:21 +02:00
packet
phonet
psample
qrtr net: qrtr: fix a kernel-infoleak in qrtr_recvmsg() 2021-03-30 14:40:12 +02:00
rds
rfkill
rose rose: Fix Null pointer dereference in rose_send_frame() 2020-12-08 10:17:32 +01:00
rxrpc rxrpc: Fix handling of an unsupported token type in rxrpc_read() 2021-01-23 15:48:47 +01:00
sched net: sched: sch_teql: fix null-pointer dereference 2021-04-16 11:57:48 +02:00
sctp sctp: fix a SCTP_MIB_CURRESTAB leak in sctp_sf_do_dupcook_b 2021-05-22 10:57:38 +02:00
smc
strparser
sunrpc rpc: fix NULL dereference on kmalloc failure 2021-04-07 12:47:00 +02:00
switchdev
tipc tipc: convert dest node's address to network order 2021-05-22 10:57:35 +02:00
tls
unix
vmw_vsock vsock/vmci: log once the failed queue pair allocation 2021-05-22 10:57:34 +02:00
wimax
wireless cfg80211: scan: drop entry from hidden_list on overflow 2021-05-22 10:57:25 +02:00
x25 net/x25: prevent a couple of overflows 2020-12-08 10:17:33 +01:00
xfrm xfrm: Fix oops in xfrm_replay_advance_bmp 2021-02-03 23:22:22 +01:00
compat.c
Kconfig
Makefile
socket.c
sysctl_net.c