aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/cluster/tcp.c
diff options
context:
space:
mode:
authorJoseph Qi <joseph.qi@huawei.com>2014-10-09 18:24:58 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-10-09 22:25:47 -0400
commit4a4e07c1bdbbc24d905e4c266b92cada9371db5d (patch)
tree50bbab4fdef17e08dd46bddbc67bee7c389dc9d6 /fs/ocfs2/cluster/tcp.c
parent7fa05c6e46d76378d4403669ba6ea38364f910ac (diff)
ocfs2: call o2quo_exit() if malloc failed in o2net_init()
In o2net_init, if malloc failed, it directly returns -ENOMEM. Then o2quo_exit won't be called in init_o2nm. Signed-off-by: Joseph Qi <joseph.qi@huawei.com> Reviewed-by: joyce.xue <xuejiufei@huawei.com> Cc: Mark Fasheh <mfasheh@suse.com> Cc: Joel Becker <jlbec@evilplan.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ocfs2/cluster/tcp.c')
-rw-r--r--fs/ocfs2/cluster/tcp.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c
index ea34952f9496..56cebba2390c 100644
--- a/fs/ocfs2/cluster/tcp.c
+++ b/fs/ocfs2/cluster/tcp.c
@@ -2146,17 +2146,13 @@ int o2net_init(void)
2146 o2quo_init(); 2146 o2quo_init();
2147 2147
2148 if (o2net_debugfs_init()) 2148 if (o2net_debugfs_init())
2149 return -ENOMEM; 2149 goto out;
2150 2150
2151 o2net_hand = kzalloc(sizeof(struct o2net_handshake), GFP_KERNEL); 2151 o2net_hand = kzalloc(sizeof(struct o2net_handshake), GFP_KERNEL);
2152 o2net_keep_req = kzalloc(sizeof(struct o2net_msg), GFP_KERNEL); 2152 o2net_keep_req = kzalloc(sizeof(struct o2net_msg), GFP_KERNEL);
2153 o2net_keep_resp = kzalloc(sizeof(struct o2net_msg), GFP_KERNEL); 2153 o2net_keep_resp = kzalloc(sizeof(struct o2net_msg), GFP_KERNEL);
2154 if (!o2net_hand || !o2net_keep_req || !o2net_keep_resp) { 2154 if (!o2net_hand || !o2net_keep_req || !o2net_keep_resp)
2155 kfree(o2net_hand); 2155 goto out;
2156 kfree(o2net_keep_req);
2157 kfree(o2net_keep_resp);
2158 return -ENOMEM;
2159 }
2160 2156
2161 o2net_hand->protocol_version = cpu_to_be64(O2NET_PROTOCOL_VERSION); 2157 o2net_hand->protocol_version = cpu_to_be64(O2NET_PROTOCOL_VERSION);
2162 o2net_hand->connector_id = cpu_to_be64(1); 2158 o2net_hand->connector_id = cpu_to_be64(1);
@@ -2181,6 +2177,14 @@ int o2net_init(void)
2181 } 2177 }
2182 2178
2183 return 0; 2179 return 0;
2180
2181out:
2182 kfree(o2net_hand);
2183 kfree(o2net_keep_req);
2184 kfree(o2net_keep_resp);
2185
2186 o2quo_exit();
2187 return -ENOMEM;
2184} 2188}
2185 2189
2186void o2net_exit(void) 2190void o2net_exit(void)