]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ocfs2: fix error handling when creating debugfs root in ocfs2_init()
authorJan Kara <jack@suse.cz>
Wed, 10 Dec 2014 23:41:56 +0000 (15:41 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 11 Dec 2014 01:41:03 +0000 (17:41 -0800)
Error handling if creation of root of debugfs in ocfs2_init() fails is
broken.  Although error code is set we fail to exit ocfs2_init() with
error and thus initialization ends with success.  Later when mounting a
filesystem, ocfs2 debugfs entries end up being created in the root of
debugfs filesystem which is confusing.

Fix the error handling to bail out.

Coverity id: 1227009.

Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Joseph Qi <joseph.qi@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/super.c

index 93c85bc745e199983550b2e181b757e151cec8d5..8e3ac25efb9fc1384a0cb4abb8b6b1a5cfdeb992 100644 (file)
@@ -1622,8 +1622,9 @@ static int __init ocfs2_init(void)
 
        ocfs2_debugfs_root = debugfs_create_dir("ocfs2", NULL);
        if (!ocfs2_debugfs_root) {
-               status = -EFAULT;
+               status = -ENOMEM;
                mlog(ML_ERROR, "Unable to create ocfs2 debugfs root.\n");
+               goto out4;
        }
 
        ocfs2_set_locking_protocol();