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-next>] [day] [month] [year] [list]
Message-Id: <1451772666-2139-1-git-send-email-richard@nod.at>
Date:	Sat,  2 Jan 2016 23:11:06 +0100
From:	Richard Weinberger <richard@....at>
To:	dedekind1@...il.com
Cc:	adrian.hunter@...el.com, linux-mtd@...ts.infradead.org,
	linux-kernel@...r.kernel.org, Richard Weinberger <richard@....at>,
	stable@...r.kernel.org
Subject: [PATCH] ubifs: Fix error codes in ubifs_iget()

We cannot use positive error codes in ERR_PTR().
IS_ERR() won't catch them.

Cc: stable@...r.kernel.org
Signed-off-by: Richard Weinberger <richard@....at>
---
 fs/ubifs/super.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 1fd90c0..c7d8230 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -173,7 +173,7 @@ struct inode *ubifs_iget(struct super_block *sb, unsigned long inum)
 			memcpy(ui->data, ino->data, ui->data_len);
 			((char *)ui->data)[ui->data_len] = '\0';
 		} else if (ui->data_len != 0) {
-			err = 10;
+			err = -EINVAL;
 			goto out_invalid;
 		}
 		break;
@@ -181,14 +181,14 @@ struct inode *ubifs_iget(struct super_block *sb, unsigned long inum)
 		inode->i_op  = &ubifs_dir_inode_operations;
 		inode->i_fop = &ubifs_dir_operations;
 		if (ui->data_len != 0) {
-			err = 11;
+			err = -EINVAL;
 			goto out_invalid;
 		}
 		break;
 	case S_IFLNK:
 		inode->i_op = &ubifs_symlink_inode_operations;
 		if (ui->data_len <= 0 || ui->data_len > UBIFS_MAX_INO_DATA) {
-			err = 12;
+			err = -EINVAL;
 			goto out_invalid;
 		}
 		ui->data = kmalloc(ui->data_len + 1, GFP_NOFS);
@@ -218,7 +218,7 @@ struct inode *ubifs_iget(struct super_block *sb, unsigned long inum)
 		else if (ui->data_len == sizeof(dev->huge))
 			rdev = huge_decode_dev(le64_to_cpu(dev->huge));
 		else {
-			err = 13;
+			err = -EINVAL;
 			goto out_invalid;
 		}
 		memcpy(ui->data, ino->data, ui->data_len);
@@ -231,12 +231,12 @@ struct inode *ubifs_iget(struct super_block *sb, unsigned long inum)
 		inode->i_op = &ubifs_file_inode_operations;
 		init_special_inode(inode, inode->i_mode, 0);
 		if (ui->data_len != 0) {
-			err = 14;
+			err = -EINVAL;
 			goto out_invalid;
 		}
 		break;
 	default:
-		err = 15;
+		err = -EINVAL;
 		goto out_invalid;
 	}
 
-- 
2.5.0

--
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