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>] [day] [month] [year] [list]
Message-Id: <1427122377-26332-1-git-send-email-sanidhya.gatech@gmail.com>
Date:	Mon, 23 Mar 2015 10:52:57 -0400
From:	Sanidhya Kashyap <sanidhya.gatech@...il.com>
To:	dedekind1@...il.com, adrian.hunter@...el.com,
	linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org
Cc:	taesoo@...ech.edu, changwoo@...ech.edu, sanidhya@...ech.edu,
	blee@...ech.edu, csong84@...ech.edu,
	Sanidhya Kashyap <sanidhya.gatech@...il.com>
Subject: [PATCH] ubifs: propagate error value than 0

Currently, ubifs_readpage only returns 0 even if ubifs_bulk_read()
fails. Therefore propagating error to the above functions which
have called ubifs_readpage.

Another check that is missing is ENOMEM for kmalloc in ubifs_bulk_read.

Signed-off-by: Sanidhya Kashyap <sanidhya.gatech@...il.com>
---
 fs/ubifs/file.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c
index e627c0a..b2d1de0 100644
--- a/fs/ubifs/file.c
+++ b/fs/ubifs/file.c
@@ -863,8 +863,10 @@ static int ubifs_bulk_read(struct page *page)
 		bu = &c->bu;
 	else {
 		bu = kmalloc(sizeof(struct bu_info), GFP_NOFS | __GFP_NOWARN);
-		if (!bu)
+		if (!bu) {
+			err = -ENOMEM;
 			goto out_unlock;
+		}
 
 		bu->buf = NULL;
 		allocated = 1;
@@ -887,8 +889,11 @@ out_unlock:
 
 static int ubifs_readpage(struct file *file, struct page *page)
 {
-	if (ubifs_bulk_read(page))
-		return 0;
+	int err = 0;
+
+	err = ubifs_bulk_read(page);
+	if (err)
+		return err;
 	do_readpage(page);
 	unlock_page(page);
 	return 0;
-- 
2.1.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