lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1400156776-3412-2-git-send-email-waydi1@gmail.com>
Date:	Thu, 15 May 2014 21:26:16 +0900
From:	Seunghun Lee <waydi1@...il.com>
To:	jack@...e.cz
Cc:	lczerner@...hat.com, linux-ext4@...r.kernel.org,
	linux-kernel@...r.kernel.org, Seunghun Lee <waydi1@...il.com>
Subject: [PATCH 2/2] ext2: fix error handling in ext2_fill_super()

ext2_fill_super is using err variable, but it is not applied to return value.

This patch fixes it.

Signed-off-by: Seunghun Lee <waydi1@...il.com>
---
 fs/ext2/super.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index e3fc51e..7e36536 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -770,14 +770,13 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
 	unsigned long logic_sb_block;
 	unsigned long offset = 0;
 	unsigned long def_mount_opts;
-	int ret = -EINVAL;
+	int ret = -ENOMEM;
 	int blocksize = BLOCK_SIZE;
 	int db_count;
 	int i, j;
 	__le32 features;
-	int err;
+	int err = 0;
 
-	err = -ENOMEM;
 	sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
 	if (!sbi)
 		goto failed;
@@ -793,6 +792,9 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
 
 	spin_lock_init(&sbi->s_lock);
 
+	/* -EINVAL is default */
+	ret = -EINVAL;
+
 	/*
 	 * See what the current blocksize for the device is, and
 	 * use that as the blocksize.  Otherwise (or if the blocksize
@@ -1140,7 +1142,7 @@ failed_sbi:
 	kfree(sbi->s_blockgroup_lock);
 	kfree(sbi);
 failed:
-	return ret;
+	return err ? err : ret;
 }
 
 static void ext2_clear_super_error(struct super_block *sb)
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ