diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-03-17 22:03:58 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-03-20 21:29:49 -0400 |
commit | 342827d7d19cb52b562bb3efeb4d4b672d008c35 (patch) | |
tree | 92b2155e8febaf9a9e5caad01f5929d9f63bcd11 /fs/ocfs2 | |
parent | 0794f569ec307dc25bbb12456ef75aa71f72f744 (diff) |
ocfs2: fix leaks on failure exits in module_init
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/ocfs2')
-rw-r--r-- | fs/ocfs2/super.c | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 337687c3e233..68f4541c2db9 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -1624,21 +1624,17 @@ static int __init ocfs2_init(void) | |||
1624 | init_waitqueue_head(&ocfs2__ioend_wq[i]); | 1624 | init_waitqueue_head(&ocfs2__ioend_wq[i]); |
1625 | 1625 | ||
1626 | status = init_ocfs2_uptodate_cache(); | 1626 | status = init_ocfs2_uptodate_cache(); |
1627 | if (status < 0) { | 1627 | if (status < 0) |
1628 | mlog_errno(status); | 1628 | goto out1; |
1629 | goto leave; | ||
1630 | } | ||
1631 | 1629 | ||
1632 | status = ocfs2_initialize_mem_caches(); | 1630 | status = ocfs2_initialize_mem_caches(); |
1633 | if (status < 0) { | 1631 | if (status < 0) |
1634 | mlog_errno(status); | 1632 | goto out2; |
1635 | goto leave; | ||
1636 | } | ||
1637 | 1633 | ||
1638 | ocfs2_wq = create_singlethread_workqueue("ocfs2_wq"); | 1634 | ocfs2_wq = create_singlethread_workqueue("ocfs2_wq"); |
1639 | if (!ocfs2_wq) { | 1635 | if (!ocfs2_wq) { |
1640 | status = -ENOMEM; | 1636 | status = -ENOMEM; |
1641 | goto leave; | 1637 | goto out3; |
1642 | } | 1638 | } |
1643 | 1639 | ||
1644 | ocfs2_debugfs_root = debugfs_create_dir("ocfs2", NULL); | 1640 | ocfs2_debugfs_root = debugfs_create_dir("ocfs2", NULL); |
@@ -1650,17 +1646,23 @@ static int __init ocfs2_init(void) | |||
1650 | ocfs2_set_locking_protocol(); | 1646 | ocfs2_set_locking_protocol(); |
1651 | 1647 | ||
1652 | status = register_quota_format(&ocfs2_quota_format); | 1648 | status = register_quota_format(&ocfs2_quota_format); |
1653 | leave: | 1649 | if (status < 0) |
1654 | if (status < 0) { | 1650 | goto out4; |
1655 | ocfs2_free_mem_caches(); | 1651 | status = register_filesystem(&ocfs2_fs_type); |
1656 | exit_ocfs2_uptodate_cache(); | 1652 | if (!status) |
1657 | mlog_errno(status); | 1653 | return 0; |
1658 | } | ||
1659 | 1654 | ||
1660 | if (status >= 0) { | 1655 | unregister_quota_format(&ocfs2_quota_format); |
1661 | return register_filesystem(&ocfs2_fs_type); | 1656 | out4: |
1662 | } else | 1657 | destroy_workqueue(ocfs2_wq); |
1663 | return -1; | 1658 | debugfs_remove(ocfs2_debugfs_root); |
1659 | out3: | ||
1660 | ocfs2_free_mem_caches(); | ||
1661 | out2: | ||
1662 | exit_ocfs2_uptodate_cache(); | ||
1663 | out1: | ||
1664 | mlog_errno(status); | ||
1665 | return status; | ||
1664 | } | 1666 | } |
1665 | 1667 | ||
1666 | static void __exit ocfs2_exit(void) | 1668 | static void __exit ocfs2_exit(void) |