Function tcp_create_listen_sock has two error paths. One of them was setting con->sock to NULL. The other was not. This patch changes it to be consistent and do the same thing for both error paths.
Signed-off-by: Bob Peterson <rpete...@redhat.com> --- fs/dlm/lowcomms.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index e740326..3b780f0 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c @@ -1199,10 +1199,7 @@ static struct socket *tcp_create_listen_sock(struct connection *con, result = sock->ops->bind(sock, (struct sockaddr *) saddr, addr_len); if (result < 0) { log_print("Can't bind to port %d", dlm_config.ci_tcp_port); - sock_release(sock); - sock = NULL; - con->sock = NULL; - goto create_out; + goto out_err; } result = kernel_setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, (char *)&one, sizeof(one)); @@ -1213,13 +1210,18 @@ static struct socket *tcp_create_listen_sock(struct connection *con, result = sock->ops->listen(sock, 5); if (result < 0) { log_print("Can't listen on port %d", dlm_config.ci_tcp_port); - sock_release(sock); - sock = NULL; - goto create_out; + goto out_err; } create_out: return sock; + +out_err: + sock_release(sock); + sock = NULL; + con->sock = NULL; + + goto create_out; } /* Get local addresses */ -- 2.5.0