android_kernel_google_msm/net/rds
Quentin Casasnovas 4ee85dafc1 RDS: fix race condition when sending a message on unbound socket
commit 8c7188b23474cca017b3ef354c4a58456f68303a upstream.

Sasha's found a NULL pointer dereference in the RDS connection code when
sending a message to an apparently unbound socket.  The problem is caused
by the code checking if the socket is bound in rds_sendmsg(), which checks
the rs_bound_addr field without taking a lock on the socket.  This opens a
race where rs_bound_addr is temporarily set but where the transport is not
in rds_bind(), leading to a NULL pointer dereference when trying to
dereference 'trans' in __rds_conn_create().

Vegard wrote a reproducer for this issue, so kindly ask him to share if
you're interested.

I cannot reproduce the NULL pointer dereference using Vegard's reproducer
with this patch, whereas I could without.

Complete earlier incomplete fix to CVE-2015-6937:

  74e98eb08588 ("RDS: verify the underlying transport exists before creating a connection")

Cc: David S. Miller <davem@davemloft.net>

Reviewed-by: Vegard Nossum <vegard.nossum@oracle.com>
Reviewed-by: Sasha Levin <sasha.levin@oracle.com>
Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>
Signed-off-by: Quentin Casasnovas <quentin.casasnovas@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Zefan Li <lizefan@huawei.com>
2016-03-21 09:17:54 +08:00
..
Kconfig rds: drop "select LLIST" 2011-11-14 00:10:50 -05:00
Makefile
af_rds.c rds: Make rds_sock_lock BH rather than IRQ safe. 2012-01-24 17:03:44 -05:00
bind.c
cong.c net: Add export.h for EXPORT_SYMBOL/THIS_MODULE to non-modules 2011-10-31 19:30:30 -04:00
connection.c RDS: fix race condition when sending a message on unbound socket 2016-03-21 09:17:54 +08:00
ib.c rds: prevent dereference of a NULL device 2014-01-15 15:27:11 -08:00
ib.h
ib_cm.c RDS: use gfp flags from caller in conn_alloc() 2012-03-22 19:29:58 -04:00
ib_rdma.c rds: rds_ib_device.refcount overflow 2016-03-21 09:17:44 +08:00
ib_recv.c Merge branch 'kmap_atomic' of git://github.com/congwang/linux 2012-03-21 09:40:26 -07:00
ib_ring.c
ib_send.c rds: prevent BUG_ON triggered on congestion update to loopback 2014-01-15 15:27:10 -08:00
ib_stats.c
ib_sysctl.c
info.c rds: fix an integer overflow test in rds_info_getsockopt() 2016-03-21 09:17:50 +08:00
info.h
iw.c rds: prevent dereference of a NULL device in rds_iw_laddr_check 2014-04-26 17:13:18 -07:00
iw.h
iw_cm.c RDS: use gfp flags from caller in conn_alloc() 2012-03-22 19:29:58 -04:00
iw_rdma.c RDS: Remove some unused iWARP code 2012-01-12 20:05:28 -08:00
iw_recv.c Merge branch 'kmap_atomic' of git://github.com/congwang/linux 2012-03-21 09:40:26 -07:00
iw_ring.c
iw_send.c
iw_stats.c
iw_sysctl.c
loop.c RDS: use gfp flags from caller in conn_alloc() 2012-03-22 19:29:58 -04:00
loop.h
message.c rds: limit the size allocated by rds_message_alloc() 2013-03-20 13:05:01 -07:00
page.c net: Add export.h for EXPORT_SYMBOL/THIS_MODULE to non-modules 2011-10-31 19:30:30 -04:00
rdma.c
rdma_transport.c net: Fix files explicitly needing to include module.h 2011-10-31 19:30:28 -04:00
rdma_transport.h
rds.h rds: remove the second argument of k[un]map_atomic() 2012-03-20 21:48:28 +08:00
recv.c net: rework recvmsg handler msg_name and msg_namelen logic 2013-12-08 07:29:41 -08:00
send.c RDS: fix race condition when sending a message on unbound socket 2016-03-21 09:17:54 +08:00
stats.c net: Add export.h for EXPORT_SYMBOL/THIS_MODULE to non-modules 2011-10-31 19:30:30 -04:00
sysctl.c
tcp.c net: Fix files explicitly needing to include module.h 2011-10-31 19:30:28 -04:00
tcp.h
tcp_connect.c
tcp_listen.c
tcp_recv.c rds: remove the second argument of k[un]map_atomic() 2012-03-20 21:48:28 +08:00
tcp_send.c
tcp_stats.c
threads.c net: Add export.h for EXPORT_SYMBOL/THIS_MODULE to non-modules 2011-10-31 19:30:30 -04:00
transport.c