All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ryan O'Hara <rohara@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH] GFS2 security initialization
Date: Fri, 29 Sep 2006 16:23:25 -0500	[thread overview]
Message-ID: <451D8ECD.9040200@redhat.com> (raw)

Initialize SELinux extended attributes at inode creation time.

This patch has gfs2_security_init declared as a static function, which 
is correct. As a result, the declaration of this function in inode.h is 
removed (and thus inode.h is unchanged). Also removed #include eaops.h, 
which is not needed.

Signed-Off-By: Ryan O'Hara <rohara@redhat.com>
---

diff -urpN a/fs/gfs2/inode.c b/fs/gfs2/inode.c
--- a/fs/gfs2/inode.c   2006-09-29 12:34:22.000000000 -0500
+++ b/fs/gfs2/inode.c   2006-09-29 16:09:31.000000000 -0500
@@ -17,6 +17,7 @@
  #include <linux/gfs2_ondisk.h>
  #include <linux/crc32.h>
  #include <linux/lm_interface.h>
+#include <linux/security.h>

  #include "gfs2.h"
  #include "incore.h"
@@ -806,6 +807,39 @@ fail:
         return error;
  }

+static int gfs2_security_init(struct gfs2_inode *dip, struct gfs2_inode 
*ip)
+{
+       int err;
+       size_t len;
+       void *value;
+       char *name;
+       struct gfs2_ea_request er;
+
+       err = security_inode_init_security(&ip->i_inode, &dip->i_inode,
+                                          &name, &value, &len);
+
+       if (err) {
+               if (err == -EOPNOTSUPP)
+                       return 0;
+               return err;
+       }
+
+       memset(&er, 0, sizeof(struct gfs2_ea_request));
+
+       er.er_type = GFS2_EATYPE_SECURITY;
+       er.er_name = name;
+       er.er_data = value;
+       er.er_name_len = strlen(name);
+       er.er_data_len = len;
+
+       err = gfs2_ea_set_i(ip, &er);
+
+       kfree(value);
+       kfree(name);
+
+       return err;
+}
+
  /**
   * gfs2_createi - Create a new inode
   * @ghs: An array of two holders
@@ -897,6 +931,10 @@ struct inode *gfs2_createi(struct gfs2_h
         if (error)
                 goto fail_iput;

+       error = gfs2_security_init(dip, GFS2_I(inode));
+       if (error)
+               goto fail_iput;
+
         error = link_dinode(dip, name, GFS2_I(inode));
         if (error)
                 goto fail_iput;



                 reply	other threads:[~2006-09-29 21:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=451D8ECD.9040200@redhat.com \
    --to=rohara@redhat.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.