]> git.baikalelectronics.ru Git - kernel.git/commit
RDS: TCP: Add/use rds_tcp_reset_callbacks to reset tcp socket safely
authorSowmini Varadhan <sowmini.varadhan@oracle.com>
Sat, 4 Jun 2016 20:59:58 +0000 (13:59 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 7 Jun 2016 22:10:15 +0000 (15:10 -0700)
commit9057400933bae7e1e0ab1249442060ae641b109c
treec09223b2cdbe5b6a9d876ad07a9ee29cebcb8588
parentdf6df82b0021cc9d78ca6abe37ef2a7bc04a64d1
RDS: TCP: Add/use rds_tcp_reset_callbacks to reset tcp socket safely

When rds_tcp_accept_one() has to replace the existing tcp socket
with a newer tcp socket (duelling-syn resolution), it must lock_sock()
to suppress the rds_tcp_data_recv() path while callbacks are being
changed.  Also, existing RDS datagram reassembly state must be reset,
so that the next datagram on the new socket  does not have corrupted
state. Similarly when resetting the newly accepted socket, appropriate
locks and synchronization is needed.

This commit ensures correct synchronization by invoking
kernel_sock_shutdown to reset a newly accepted sock, and by taking
appropriate lock_sock()s (for old and new sockets) when resetting
existing callbacks.

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>
net/rds/tcp.c
net/rds/tcp.h
net/rds/tcp_listen.c