summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCasey Dahlin <cdahlin@redhat.com>2009-07-14 19:17:51 +0200
committerDavid Teigland <teigland@redhat.com>2009-07-14 19:28:43 +0200
commita89d63a159b1ba5833be2bef00adf8ad8caac8be (patch)
tree520fa4131a549d1956c2a938e8e5a682e1ef5dab
parentdlm: fix plock use-after-free (diff)
downloadlinux-a89d63a159b1ba5833be2bef00adf8ad8caac8be.tar.xz
linux-a89d63a159b1ba5833be2bef00adf8ad8caac8be.zip
dlm: free socket in error exit path
In the tcp_connect_to_sock() error exit path, the socket allocated at the top of the function was not being freed. Signed-off-by: Casey Dahlin <cdahlin@redhat.com> Signed-off-by: David Teigland <teigland@redhat.com>
-rw-r--r--fs/dlm/lowcomms.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index cdb580a9c7a2..618a60f03886 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -902,7 +902,7 @@ static void tcp_connect_to_sock(struct connection *con)
int result = -EHOSTUNREACH;
struct sockaddr_storage saddr, src_addr;
int addr_len;
- struct socket *sock;
+ struct socket *sock = NULL;
if (con->nodeid == 0) {
log_print("attempt to connect sock 0 foiled");
@@ -962,6 +962,8 @@ out_err:
if (con->sock) {
sock_release(con->sock);
con->sock = NULL;
+ } else if (sock) {
+ sock_release(sock);
}
/*
* Some errors are fatal and this list might need adjusting. For other