linux-stable/net/rds
Sowmini Varadhan ea620e414b rds; Reset rs->rs_bound_addr in rds_add_bound() failure path
[ Upstream commit 7ae0c649c4 ]

If the rds_sock is not added to the bind_hash_table, we must
reset rs_bound_addr so that rds_remove_bound will not trip on
this rds_sock.

rds_add_bound() does a rds_sock_put() in this failure path, so
failing to reset rs_bound_addr will result in a socket refcount
bug, and will trigger a WARN_ON with the stack shown below when
the application subsequently tries to close the PF_RDS socket.

     WARNING: CPU: 20 PID: 19499 at net/rds/af_rds.c:496 \
		rds_sock_destruct+0x15/0x30 [rds]
       :
     __sk_destruct+0x21/0x190
     rds_remove_bound.part.13+0xb6/0x140 [rds]
     rds_release+0x71/0x120 [rds]
     sock_release+0x1a/0x70
     sock_close+0xe/0x20
     __fput+0xd5/0x210
     task_work_run+0x82/0xa0
     do_exit+0x2ce/0xb30
     ? syscall_trace_enter+0x1cc/0x2b0
     do_group_exit+0x39/0xa0
     SyS_exit_group+0x10/0x10
     do_syscall_64+0x61/0x1a0

Signed-off-by: Sowmini Varadhan <sowmini.varadhan@oracle.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-12 12:32:12 +02:00
..
af_rds.c RDS: validate the requested traces user input against max supported 2017-01-06 22:14:26 -05:00
bind.c rds; Reset rs->rs_bound_addr in rds_add_bound() failure path 2018-04-12 12:32:12 +02:00
cong.c RDS: split out connection specific state from rds_connection to rds_conn_path 2016-06-14 23:50:41 -07:00
connection.c rds: tcp: correctly sequence cleanup on netns deletion. 2018-02-25 11:07:50 +01:00
ib.c net, rds: convert rds_ib_device.refcount from atomic_t to refcount_t 2017-07-04 22:35:17 +01:00
ib.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ib_cm.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2017-03-15 11:59:10 -07:00
ib_fmr.c rds: ib: unmap the scatter/gather list when error 2017-03-13 23:20:05 -07:00
ib_frmr.c RDS: IB: split the mr registration and invalidation path 2017-01-02 14:02:47 -08:00
ib_mr.h rds: ib: add the static type to the function 2017-03-13 23:20:05 -07:00
ib_rdma.c net, rds: convert rds_ib_device.refcount from atomic_t to refcount_t 2017-07-04 22:35:17 +01:00
ib_recv.c rds: ib: Fix NULL pointer dereference in debug code 2017-11-10 14:54:47 +09:00
ib_ring.c
ib_send.c rds: Fix inaccurate accounting of unsignaled wrs 2017-10-26 17:35:57 +09:00
ib_stats.c RDS: IB: add few useful cache stasts 2017-01-02 14:02:51 -08:00
ib_sysctl.c
info.c rds: fix an integer overflow test in rds_info_getsockopt() 2015-08-03 15:20:16 -07:00
info.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Kconfig RDS: Drop stale iWARP RDMA transport 2016-03-02 14:13:17 -05:00
loop.c RDS: TCP: Hooks to set up a single connection path 2016-07-01 16:45:17 -04:00
loop.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
message.c net, rds: convert rds_message.m_refcount from atomic_t to refcount_t 2017-07-04 22:35:18 +01:00
page.c rds: remove dead code 2016-12-26 21:35:39 -05:00
rdma.c RDS: null pointer dereference in rds_atomic_free_op 2018-01-17 09:45:21 +01:00
rdma_transport.c RDS: RDMA: start rdma listening after init 2017-01-02 14:02:45 -08:00
rdma_transport.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
rds.h rds: tcp: correctly sequence cleanup on netns deletion. 2018-02-25 11:07:50 +01:00
rds_single_path.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
recv.c net, rds: convert rds_incoming.i_refcount from atomic_t to refcount_t 2017-07-04 22:35:17 +01:00
send.c RDS: Check cmsg_len before dereferencing CMSG_DATA 2018-01-02 20:31:07 +01:00
stats.c
sysctl.c net: rds: fix coding style issues 2016-06-18 21:34:09 -07:00
tcp.c rds: tcp: atomically purge entries from rds_tcp_conn_list during netns delete 2018-02-25 11:07:51 +01:00
tcp.h rds: tcp: atomically purge entries from rds_tcp_conn_list during netns delete 2018-02-25 11:07:51 +01:00
tcp_connect.c rds: cancel send/recv work before queuing connection shutdown 2017-07-16 19:07:35 -07:00
tcp_listen.c rds: tcp: use sock_create_lite() to create the accept socket 2017-07-08 11:16:16 +01:00
tcp_recv.c RDS: add receive message trace used by application 2017-01-02 14:02:59 -08:00
tcp_send.c rds: cancel send/recv work before queuing connection shutdown 2017-07-16 19:07:35 -07:00
tcp_stats.c
threads.c rds: cancel send/recv work before queuing connection shutdown 2017-07-16 19:07:35 -07:00
transport.c rds: remove unnecessary returned value check 2017-03-03 09:51:22 -08:00