]> git.baikalelectronics.ru Git - kernel.git/commit
net/rds: do proper house keeping if connection fails in rds_tcp_conn_connect
authorHerton R. Krzesinski <herton@redhat.com>
Wed, 1 Oct 2014 21:49:53 +0000 (18:49 -0300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 3 Oct 2014 19:51:59 +0000 (12:51 -0700)
commite65bad542e6aa1ca4434c09af4aae3b01d1c0448
treef3b45a40a460a4a70ad9436ded5b1daa1da802fc
parent5f57a749f245b7f41bc0be7951f8654063f6a185
net/rds: do proper house keeping if connection fails in rds_tcp_conn_connect

I see two problems if we consider the sock->ops->connect attempt to fail in
rds_tcp_conn_connect. The first issue is that for example we don't remove the
previously added rds_tcp_connection item to rds_tcp_tc_list at
rds_tcp_set_callbacks, which means that on a next reconnect attempt for the
same rds_connection, when rds_tcp_conn_connect is called we can again call
rds_tcp_set_callbacks, resulting in duplicated items on rds_tcp_tc_list,
leading to list corruption: to avoid this just make sure we call
properly rds_tcp_restore_callbacks before we exit. The second issue
is that we should also release the sock properly, by setting sock = NULL
only if we are returning without error.

Signed-off-by: Herton R. Krzesinski <herton@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/rds/tcp_connect.c