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: <20100306112125.GN4958@bicker>
Date:	Sat, 6 Mar 2010 14:21:25 +0300
From:	Dan Carpenter <error27@...il.com>
To:	Mimi Zohar <zohar@...ibm.com>
Cc:	James Morris <jmorris@...ei.org>, Eric Paris <eparis@...hat.com>,
	Al Viro <viro@...iv.linux.org.uk>,
	"J.R. Okajima" <hooanon05@...oo.co.jp>,
	linux-security-module@...r.kernel.org,
	linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [patch] security: ima_file_mmap() don't just return zero

It seems like we should return an error here.  That's what the comment
says we should do.

I also removed an out of date comment.  It wasn't needed and seemed likely
to get out of date again.

Signed-off-by: Dan Carpenter <error27@...il.com>
---
This was found with a static checker and I have only compile tested it.
The callers all seem to use the return code, but please review carefully.
The code has been like this since the module was merged.

diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c
index 294b005..90d5314 100644
--- a/security/integrity/ima/ima_main.c
+++ b/security/integrity/ima/ima_main.c
@@ -260,18 +260,17 @@ out:
  * policy decision.
  *
  * Return 0 on success, an error code on failure.
- * (Based on the results of appraise_measurement().)
  */
 int ima_file_mmap(struct file *file, unsigned long prot)
 {
-	int rc;
+	int rc = 0;
 
 	if (!file)
 		return 0;
 	if (prot & PROT_EXEC)
 		rc = process_measurement(file, file->f_dentry->d_name.name,
 					 MAY_EXEC, FILE_MMAP);
-	return 0;
+	return rc;
 }
 
 /**
--
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