mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serge@hallyn.com>
To: Mimi Zohar <zohar@linux.vnet.ibm.com>
Cc: James Morris <jmorris@namei.org>,
	linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-security-module@vger.kernel.org,
	Christoph Hellwig <hch@infradead.org>,
	Dave Hansen <dave@linux.vnet.ibm.com>,
	"<David Safford" <safford@watson.ibm.com>,
	Serge Hallyn <serue@us.ibm.com>, Mimi Zohar <zohar@us.ibm.com>
Subject: Re: [PATCH 3/6] integrity: IMA display
Date: Mon, 2 Feb 2009 17:14:28 -0600	[thread overview]
Message-ID: <20090202231428.GB18452@hallyn.com> (raw)
In-Reply-To: <1233321251.3602.3.camel@localhost.localdomain>

Quoting Mimi Zohar (zohar@linux.vnet.ibm.com):
> On Fri, 2009-01-30 at 20:18 +1100, James Morris wrote:
> > On Thu, 29 Jan 2009, Mimi Zohar wrote:
> > 
> > > +int ima_fs_init(void)
> > > +{
> > > +	ima_dir = securityfs_create_dir("ima", NULL);
> > > +	if (!ima_dir || IS_ERR(ima_dir))
> > > +		return -1;
> > > +
> > > +	binary_runtime_measurements =
> > > +	    securityfs_create_file("binary_runtime_measurements",
> > > +				   S_IRUSR | S_IRGRP, ima_dir, NULL,
> > > +				   &ima_measurements_ops);
> > > +	if (!binary_runtime_measurements || IS_ERR(binary_runtime_measurements))
> > > +		goto out;
> > 
> > You should not be checking for NULL returns from securityfs_create_file(), 
> > because it does not return NULL (the documentation is wrong).
> > 
> > 
> > - James
> 
> Thanks!
> 
> Mimi

Wow, that's still the case??

>From dec581b116f16657db9b6f59b7e71f7a7026cd21 Mon Sep 17 00:00:00 2001
From: Serge E. Hallyn <serue@us.ibm.com>
Date: Mon, 2 Feb 2009 15:07:33 -0800
Subject: [PATCH 1/1] securityfs: fix long-broken securityfs_create_file comment

If there is an error creating a file through securityfs_create_file,
NULL is not returned, rather the error is propagated.

Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
---
 security/inode.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/security/inode.c b/security/inode.c
index efea5a6..ae243dd 100644
--- a/security/inode.c
+++ b/security/inode.c
@@ -205,12 +205,11 @@ static int create_by_name(const char *name, mode_t mode,
  * This function returns a pointer to a dentry if it succeeds.  This
  * pointer must be passed to the securityfs_remove() function when the file is
  * to be removed (no automatic cleanup happens if your module is unloaded,
- * you are responsible here).  If an error occurs, %NULL is returned.
+ * you are responsible here).  If an error occurs, the function will return
+ * the erorr value (via ERR_PTR).
  *
  * If securityfs is not enabled in the kernel, the value %-ENODEV is
- * returned.  It is not wise to check for this value, but rather, check for
- * %NULL or !%NULL instead as to eliminate the need for #ifdef in the calling
- * code.
+ * returned.
  */
 struct dentry *securityfs_create_file(const char *name, mode_t mode,
 				   struct dentry *parent, void *data,
-- 
1.5.4.3


  reply	other threads:[~2009-02-02 23:11 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-29 22:23 [PATCH 0/6] integrity Mimi Zohar
2009-01-29 22:23 ` [PATCH 1/6] integrity: IMA hooks Mimi Zohar
2009-01-29 22:23 ` [PATCH 2/6] integrity: IMA as an integrity service provider Mimi Zohar
2009-01-30  0:07   ` James Morris
2009-01-30 19:29     ` Mimi Zohar
2009-01-30  9:04   ` James Morris
2009-01-30 13:13     ` Mimi Zohar
2009-02-02 23:02   ` Serge E. Hallyn
2009-02-03  2:09     ` Mimi Zohar
2009-02-03 13:36     ` david safford
2009-02-03 14:03       ` Serge E. Hallyn
2009-01-29 22:23 ` [PATCH 3/6] integrity: IMA display Mimi Zohar
2009-01-30  9:18   ` James Morris
2009-01-30 13:14     ` Mimi Zohar
2009-02-02 23:14       ` Serge E. Hallyn [this message]
2009-02-03  0:03         ` James Morris
2009-01-29 22:23 ` [PATCH 4/6] integrity: IMA policy Mimi Zohar
2009-02-02 23:40   ` Serge E. Hallyn
2009-02-03  1:29     ` Mimi Zohar
2009-01-29 22:23 ` [PATCH 5/6] integrity: IMA policy open Mimi Zohar
2009-01-29 22:23 ` [PATCH 6/6] Integrity: IMA file free imbalance Mimi Zohar
2009-02-02 23:47   ` Serge E. Hallyn
2009-02-03  1:27     ` Mimi Zohar
2009-02-06  0:00 ` [PATCH 0/6] integrity James Morris
2009-02-06  2:29   ` Mimi Zohar
2009-02-06  8:14     ` James Morris

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=20090202231428.GB18452@hallyn.com \
    --to=serge@hallyn.com \
    --cc=akpm@linux-foundation.org \
    --cc=dave@linux.vnet.ibm.com \
    --cc=hch@infradead.org \
    --cc=jmorris@namei.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=safford@watson.ibm.com \
    --cc=serue@us.ibm.com \
    --cc=zohar@linux.vnet.ibm.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®