WSL2-Linux-Kernel/net
Mao Wenan 29b99f54a8 sctp: destroy bucket if failed to bind addr
There is one memory leak bug report:
BUG: memory leak
unreferenced object 0xffff8881dc4c5ec0 (size 40):
  comm "syz-executor.0", pid 5673, jiffies 4298198457 (age 27.578s)
  hex dump (first 32 bytes):
    02 00 00 00 81 88 ff ff 00 00 00 00 00 00 00 00  ................
    f8 63 3d c1 81 88 ff ff 00 00 00 00 00 00 00 00  .c=.............
  backtrace:
    [<0000000072006339>] sctp_get_port_local+0x2a1/0xa00 [sctp]
    [<00000000c7b379ec>] sctp_do_bind+0x176/0x2c0 [sctp]
    [<000000005be274a2>] sctp_bind+0x5a/0x80 [sctp]
    [<00000000b66b4044>] inet6_bind+0x59/0xd0 [ipv6]
    [<00000000c68c7f42>] __sys_bind+0x120/0x1f0 net/socket.c:1647
    [<000000004513635b>] __do_sys_bind net/socket.c:1658 [inline]
    [<000000004513635b>] __se_sys_bind net/socket.c:1656 [inline]
    [<000000004513635b>] __x64_sys_bind+0x3e/0x50 net/socket.c:1656
    [<0000000061f2501e>] do_syscall_64+0x72/0x2e0 arch/x86/entry/common.c:296
    [<0000000003d1e05e>] entry_SYSCALL_64_after_hwframe+0x49/0xbe

This is because in sctp_do_bind, if sctp_get_port_local is to
create hash bucket successfully, and sctp_add_bind_addr failed
to bind address, e.g return -ENOMEM, so memory leak found, it
needs to destroy allocated bucket.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Mao Wenan <maowenan@huawei.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2019-09-13 22:06:20 +02:00
..
6lowpan
9p
802
8021q
appletalk
atm
ax25
batman-adv
bluetooth Revert "Bluetooth: validate BLE connection interval updates" 2019-09-05 09:02:59 +03:00
bpf
bpfilter
bridge bridge/mdb: remove wrong use of NLM_F_MULTI 2019-09-10 09:10:53 +01:00
caif
can
ceph libceph: don't call crypto_free_sync_skcipher() on a NULL tfm 2019-08-28 12:33:46 +02:00
core net: Fix null de-reference of device refcount 2019-09-12 11:55:34 +01:00
dcb
dccp
decnet
dns_resolver
dsa net: dsa: tag_8021q: Future-proof the reserved fields in the custom VID 2019-08-27 20:31:12 -07:00
ethernet
hsr
ieee802154
ife
ipv4 tcp: fix tcp_ecn_withdraw_cwr() to clear TCP_ECN_QUEUE_CWR 2019-09-11 23:53:18 +01:00
ipv6 ipv6: Fix the link time qualifier of 'ping_v6_proc_exit_net()' 2019-09-12 11:20:33 +01:00
iucv
kcm
key
l2tp
l3mdev
lapb
llc
mac80211 mac80211: Do not send Layer 2 Update frame before authorization 2019-09-11 14:59:26 +01:00
mac802154
mpls ipv4: mpls: fix mpls_xmit for iptunnel 2019-08-25 14:34:08 -07:00
ncsi
netfilter netfilter: nf_flow_table: set default timeout after successful insertion 2019-09-03 22:55:42 +02:00
netlabel
netlink
netrom
nfc
nsh
openvswitch openvswitch: Clear the L4 portion of the key for "later" fragments. 2019-08-28 14:53:51 -07:00
packet
phonet
psample net: sched: act_sample: fix psample group handling on overwrite 2019-08-28 15:53:51 -07:00
qrtr net: qrtr: fix memort leak in qrtr_tun_write_iter 2019-09-12 11:58:44 +01:00
rds net/rds: An rds_sock is added too early to the hash table 2019-09-11 15:05:40 +01:00
rfkill
rose
rxrpc rxrpc: Fix misplaced traceline 2019-09-05 00:24:58 +02:00
sched sch_hhf: ensure quantum and hhf_non_hh_weight are non-zero 2019-09-10 18:31:00 +01:00
sctp sctp: destroy bucket if failed to bind addr 2019-09-13 22:06:20 +02:00
smc
strparser
sunrpc SUNRPC: Handle connection breakages correctly in call_status() 2019-08-26 15:31:29 -04:00
switchdev
tipc tipc: add NULL pointer check before calling kfree_rcu 2019-09-05 09:58:49 +02:00
tls
unix
vmw_vsock
wimax
wireless
x25
xdp
xfrm Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/klassert/ipsec 2019-09-06 15:09:16 +02:00
Kconfig
Makefile
compat.c
socket.c
sysctl_net.c