]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
ocfs2: call o2quo_exit() if malloc failed in o2net_init()
authorJoseph Qi <joseph.qi@huawei.com>
Thu, 9 Oct 2014 22:24:58 +0000 (15:24 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 10 Oct 2014 02:25:47 +0000 (22:25 -0400)
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>
fs/ocfs2/cluster/tcp.c

index ea34952f9496a6bfaa698165d6b818bd601ebf17..56cebba2390c7280b547f8e1c83e156bcd6398e3 100644 (file)
@@ -2146,17 +2146,13 @@ int o2net_init(void)
        o2quo_init();
 
        if (o2net_debugfs_init())
-               return -ENOMEM;
+               goto out;
 
        o2net_hand = kzalloc(sizeof(struct o2net_handshake), GFP_KERNEL);
        o2net_keep_req = kzalloc(sizeof(struct o2net_msg), GFP_KERNEL);
        o2net_keep_resp = kzalloc(sizeof(struct o2net_msg), GFP_KERNEL);
-       if (!o2net_hand || !o2net_keep_req || !o2net_keep_resp) {
-               kfree(o2net_hand);
-               kfree(o2net_keep_req);
-               kfree(o2net_keep_resp);
-               return -ENOMEM;
-       }
+       if (!o2net_hand || !o2net_keep_req || !o2net_keep_resp)
+               goto out;
 
        o2net_hand->protocol_version = cpu_to_be64(O2NET_PROTOCOL_VERSION);
        o2net_hand->connector_id = cpu_to_be64(1);
@@ -2181,6 +2177,14 @@ int o2net_init(void)
        }
 
        return 0;
+
+out:
+       kfree(o2net_hand);
+       kfree(o2net_keep_req);
+       kfree(o2net_keep_resp);
+
+       o2quo_exit();
+       return -ENOMEM;
 }
 
 void o2net_exit(void)