dlm: release socket on error

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Monday, July 28, 2008 - 10:59 am

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=311f6f...
Commit:     311f6fc77c51926dbdfbeab0a5d88d70f01fa3f4
Parent:     329fc4c37212588091b64bdf09afaeb18642aae2
Author:     Masatake YAMATO <yamato@redhat.com>
AuthorDate: Fri Jun 27 08:35:03 2008 -0500
Committer:  David Teigland <teigland@redhat.com>
CommitDate: Mon Jul 14 13:56:59 2008 -0500

    dlm: release socket on error
    
    It seems that `sock' allocated by sock_create_kern in
    tcp_connect_to_sock() of dlm/fs/lowcomms.c is not released if
    dlm_nodeid_to_addr an error.
    
    Acked-by: Christine Caulfield <ccaulfie@redhat.com>
    Signed-off-by: Masatake YAMATO <yamato@redhat.com>
    Signed-off-by: David Teigland <teigland@redhat.com>
---
 fs/dlm/lowcomms.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index 637018c..3962262 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -891,8 +891,10 @@ static void tcp_connect_to_sock(struct connection *con)
 		goto out_err;
 
 	memset(&saddr, 0, sizeof(saddr));
-	if (dlm_nodeid_to_addr(con->nodeid, &saddr))
+	if (dlm_nodeid_to_addr(con->nodeid, &saddr)) {
+		sock_release(sock);
 		goto out_err;
+	}
 
 	sock->sk->sk_user_data = con;
 	con->rx_action = receive_from_sock;
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
dlm: release socket on error, Linux Kernel Mailing ..., (Mon Jul 28, 10:59 am)