]> git.ipfire.org Git - ipfire-2.x.git/blame - src/patches/suse-2.6.27.39/patches.fixes/dlm-free-socket-in-error-exit-path.patch
Imported linux-2.6.27.39 suse/xen patches.
[ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.fixes / dlm-free-socket-in-error-exit-path.patch
CommitLineData
2cb7cef9
BS
1From a89d63a159b1ba5833be2bef00adf8ad8caac8be Mon Sep 17 00:00:00 2001
2From: Casey Dahlin <cdahlin@redhat.com>
3Date: Tue, 14 Jul 2009 12:17:51 -0500
4Subject: [PATCH] dlm: free socket in error exit path
5
6In the tcp_connect_to_sock() error exit path, the socket
7allocated at the top of the function was not being freed.
8
9Signed-off-by: Casey Dahlin <cdahlin@redhat.com>
10Signed-off-by: David Teigland <teigland@redhat.com>
11Signed-off-by: Coly Li <coly.li@suse.de>
12---
13 fs/dlm/lowcomms.c | 4 +++-
14 1 files changed, 3 insertions(+), 1 deletions(-)
15
16diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
17index cdb580a..618a60f 100644
18--- a/fs/dlm/lowcomms.c
19+++ b/fs/dlm/lowcomms.c
20@@ -902,7 +902,7 @@ static void tcp_connect_to_sock(struct connection *con)
21 int result = -EHOSTUNREACH;
22 struct sockaddr_storage saddr, src_addr;
23 int addr_len;
24- struct socket *sock;
25+ struct socket *sock = NULL;
26
27 if (con->nodeid == 0) {
28 log_print("attempt to connect sock 0 foiled");
29@@ -962,6 +962,8 @@ out_err:
30 if (con->sock) {
31 sock_release(con->sock);
32 con->sock = NULL;
33+ } else if (sock) {
34+ sock_release(sock);
35 }
36 /*
37 * Some errors are fatal and this list might need adjusting. For other
38--
391.6.0.2
40