1
0
Fork 0
remarkable-linux/net/rds
Quentin Casasnovas 28492d3072 RDS: fix race condition when sending a message on unbound socket
[ Upstream commit 8c7188b234 ]

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:

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

Cc: David S. Miller <davem@davemloft.net>
Cc: stable@vger.kernel.org

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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-12-14 21:24:32 -08:00
..
Kconfig net/rds: remove depends on CONFIG_EXPERIMENTAL 2013-01-11 11:40:02 -08:00
Makefile Net: rds: Makefile: Remove deprecated items 2010-11-22 08:16:15 -08:00
af_rds.c treewide: fix synchronize_rcu() in comments 2014-08-28 15:01:24 +02:00
bind.c net: replace macros net_random and net_srandom with direct calls to prandom 2014-01-14 15:15:25 -08:00
cong.c rds: rds_cong_queue_updates needs to defer the congestion update transmission 2015-02-11 14:35:44 -08:00
connection.c RDS: fix race condition when sending a message on unbound socket 2015-12-14 21:24:32 -08:00
ib.c rds: prevent dereference of a NULL device 2013-12-27 12:33:58 -05:00
ib.h rds: switch ->inc_copy_to_user() to passing iov_iter 2014-11-24 05:16:43 -05:00
ib_cm.c net/rds: Fix new sparse warning 2015-05-04 15:23:06 -04:00
ib_rdma.c rds: rds_ib_device.refcount overflow 2015-08-10 12:21:57 -07:00
ib_recv.c rds: switch ->inc_copy_to_user() to passing iov_iter 2014-11-24 05:16:43 -05:00
ib_ring.c RDS/IW+IB: Set recv ring low water mark to 1/2 full. 2009-04-09 17:21:14 -07:00
ib_send.c net: rds: Remove repeated function names from debug output 2015-02-07 22:41:56 -08:00
ib_stats.c RDS: Move atomic stats from general to ib-specific area 2010-09-08 18:12:20 -07:00
ib_sysctl.c net: Convert uses of typedef ctl_table to struct ctl_table 2013-06-13 02:36:09 -07:00
info.c rds: fix an integer overflow test in rds_info_getsockopt() 2015-09-29 19:26:25 +02:00
info.h RDS: Info and stats 2009-02-26 23:39:25 -08:00
iw.c rds: prevent dereference of a NULL device in rds_iw_laddr_check 2014-03-31 16:25:52 -04:00
iw.h rds: switch ->inc_copy_to_user() to passing iov_iter 2014-11-24 05:16:43 -05:00
iw_cm.c net: rds: Remove repeated function names from debug output 2015-02-07 22:41:56 -08:00
iw_rdma.c rds: avoid potential stack overflow 2015-03-12 00:28:01 -04:00
iw_recv.c rds: switch ->inc_copy_to_user() to passing iov_iter 2014-11-24 05:16:43 -05:00
iw_ring.c RDS/IW+IB: Set recv ring low water mark to 1/2 full. 2009-04-09 17:21:14 -07:00
iw_send.c net: rds: Remove repeated function names from debug output 2015-02-07 22:41:56 -08:00
iw_stats.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/percpu 2009-09-15 09:39:44 -07:00
iw_sysctl.c rds: remove the unneed NULL checking 2014-05-09 15:59:45 -04:00
loop.c RDS: use gfp flags from caller in conn_alloc() 2012-03-22 19:29:58 -04:00
loop.h RDS: loopback 2009-02-26 23:39:26 -08:00
message.c rds: Make rds_message_copy_from_user() return 0 on success. 2015-02-07 22:41:56 -08:00
page.c net: Fix (nearly-)kernel-doc comments for various functions 2012-07-10 23:13:45 -07:00
rdma.c rds: avoid calling sock_kfree_s() on allocation failure 2014-10-14 17:00:19 -04:00
rdma_transport.c RDS/RDMA: Replace comma with semicolon 2014-05-30 17:48:58 -07:00
rdma_transport.h rds: make local functions/variables static 2010-10-21 04:26:39 -07:00
rds.h Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2015-04-14 15:44:14 -04:00
recv.c net: Remove iocb argument from sendmsg and recvmsg 2015-03-02 13:06:31 -05:00
send.c RDS: fix race condition when sending a message on unbound socket 2015-12-14 21:24:32 -08:00
stats.c net/rds: zero last byte for strncpy 2013-03-08 00:35:44 -05:00
sysctl.c net: rds: use correct size for max unacked packets and bytes 2015-02-04 16:07:27 -08:00
tcp.c net: Fix files explicitly needing to include module.h 2011-10-31 19:30:28 -04:00
tcp.h rds: switch ->inc_copy_to_user() to passing iov_iter 2014-11-24 05:16:43 -05:00
tcp_connect.c net/rds: RDS-TCP: Always create a new rds_sock for an incoming connection. 2015-05-09 16:03:27 -04:00
tcp_listen.c net/rds: RDS-TCP: Always create a new rds_sock for an incoming connection. 2015-05-09 16:03:27 -04:00
tcp_recv.c RDS-TCP: Recover correctly from pskb_pull()/pksb_trim() failure in rds_tcp_data_recv 2015-12-09 14:03:10 -05:00
tcp_send.c arch: Mass conversion of smp_mb__*() 2014-04-18 14:20:48 +02:00
tcp_stats.c net: rds: fix const array syntax 2011-07-01 16:16:19 -07:00
threads.c net/rds: call rds_conn_drop instead of open code it at rds_connect_complete 2014-10-03 12:51:59 -07:00
transport.c RDS: have sockets get transport module references 2010-09-08 18:16:47 -07:00