From: Dan Carpenter <error27@gmail.com>
To: Mimi Zohar <zohar@us.ibm.com>
Cc: James Morris <jmorris@namei.org>, Eric Paris <eparis@redhat.com>,
Al Viro <viro@zeniv.linux.org.uk>,
"J.R. Okajima" <hooanon05@yahoo.co.jp>,
linux-security-module@vger.kernel.org,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] security: ima_file_mmap() don't just return zero
Date: Sat, 06 Mar 2010 11:21:25 +0000 [thread overview]
Message-ID: <20100306112125.GN4958@bicker> (raw)
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@gmail.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;
}
/**
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <error27@gmail.com>
To: Mimi Zohar <zohar@us.ibm.com>
Cc: James Morris <jmorris@namei.org>, Eric Paris <eparis@redhat.com>,
Al Viro <viro@zeniv.linux.org.uk>,
"J.R. Okajima" <hooanon05@yahoo.co.jp>,
linux-security-module@vger.kernel.org,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] security: ima_file_mmap() don't just return zero
Date: Sat, 6 Mar 2010 14:21:25 +0300 [thread overview]
Message-ID: <20100306112125.GN4958@bicker> (raw)
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@gmail.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;
}
/**
next reply other threads:[~2010-03-06 11:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-06 11:21 Dan Carpenter [this message]
2010-03-06 11:21 ` [patch] security: ima_file_mmap() don't just return zero Dan Carpenter
2010-03-06 21:30 ` Vikram Dhillon
2010-03-06 21:30 ` Vikram Dhillon
[not found] ` <OFC651A6C0.BD37C0C8-ON852576DF.0004365B-852576DF.00045289@us.ibm.com>
2010-03-07 3:29 ` Vikram Dhillon
2010-03-07 3:29 ` Vikram Dhillon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100306112125.GN4958@bicker \
--to=error27@gmail.com \
--cc=eparis@redhat.com \
--cc=hooanon05@yahoo.co.jp \
--cc=jmorris@namei.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=zohar@us.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.