Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 197950
b: refs/heads/master
c: e8c2625
h: refs/heads/master
v: v3
  • Loading branch information
Al Viro committed May 21, 2010
1 parent aa5b514 commit 1878240
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 49 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 01a05b337a5b647909e1d6670f57e7202318a5fb
refs/heads/master: e8c26255992474a2161c63ce9d385827302e4530
55 changes: 8 additions & 47 deletions trunk/security/selinux/hooks.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,6 @@ __setup("selinux=", selinux_enabled_setup);
int selinux_enabled = 1;
#endif

/* Lists of inode and superblock security structures initialized
before the policy was loaded. */
static LIST_HEAD(superblock_security_head);
static DEFINE_SPINLOCK(sb_security_lock);

static struct kmem_cache *sel_inode_cache;

/**
Expand Down Expand Up @@ -266,7 +261,6 @@ static int superblock_alloc_security(struct super_block *sb)
return -ENOMEM;

mutex_init(&sbsec->lock);
INIT_LIST_HEAD(&sbsec->list);
INIT_LIST_HEAD(&sbsec->isec_head);
spin_lock_init(&sbsec->isec_lock);
sbsec->sb = sb;
Expand All @@ -281,12 +275,6 @@ static int superblock_alloc_security(struct super_block *sb)
static void superblock_free_security(struct super_block *sb)
{
struct superblock_security_struct *sbsec = sb->s_security;

spin_lock(&sb_security_lock);
if (!list_empty(&sbsec->list))
list_del_init(&sbsec->list);
spin_unlock(&sb_security_lock);

sb->s_security = NULL;
kfree(sbsec);
}
Expand Down Expand Up @@ -612,10 +600,6 @@ static int selinux_set_mnt_opts(struct super_block *sb,
/* Defer initialization until selinux_complete_init,
after the initial policy is loaded and the security
server is ready to handle calls. */
spin_lock(&sb_security_lock);
if (list_empty(&sbsec->list))
list_add(&sbsec->list, &superblock_security_head);
spin_unlock(&sb_security_lock);
goto out;
}
rc = -EINVAL;
Expand Down Expand Up @@ -806,16 +790,10 @@ static void selinux_sb_clone_mnt_opts(const struct super_block *oldsb,

/*
* if the parent was able to be mounted it clearly had no special lsm
* mount options. thus we can safely put this sb on the list and deal
* with it later
* mount options. thus we can safely deal with this superblock later
*/
if (!ss_initialized) {
spin_lock(&sb_security_lock);
if (list_empty(&newsbsec->list))
list_add(&newsbsec->list, &superblock_security_head);
spin_unlock(&sb_security_lock);
if (!ss_initialized)
return;
}

/* how can we clone if the old one wasn't set up?? */
BUG_ON(!(oldsbsec->flags & SE_SBINITIALIZED));
Expand Down Expand Up @@ -5680,35 +5658,18 @@ static __init int selinux_init(void)
return 0;
}

static void delayed_superblock_init(struct super_block *sb, void *unused)
{
superblock_doinit(sb, NULL);
}

void selinux_complete_init(void)
{
printk(KERN_DEBUG "SELinux: Completing initialization.\n");

/* Set up any superblocks initialized prior to the policy load. */
printk(KERN_DEBUG "SELinux: Setting up existing superblocks.\n");
spin_lock(&sb_lock);
spin_lock(&sb_security_lock);
next_sb:
if (!list_empty(&superblock_security_head)) {
struct superblock_security_struct *sbsec =
list_entry(superblock_security_head.next,
struct superblock_security_struct,
list);
struct super_block *sb = sbsec->sb;
sb->s_count++;
spin_unlock(&sb_security_lock);
spin_unlock(&sb_lock);
down_read(&sb->s_umount);
if (sb->s_root)
superblock_doinit(sb, NULL);
drop_super(sb);
spin_lock(&sb_lock);
spin_lock(&sb_security_lock);
list_del_init(&sbsec->list);
goto next_sb;
}
spin_unlock(&sb_security_lock);
spin_unlock(&sb_lock);
iterate_supers(delayed_superblock_init, NULL);
}

/* SELinux requires early initialization in order to label
Expand Down
1 change: 0 additions & 1 deletion trunk/security/selinux/include/objsec.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ struct file_security_struct {

struct superblock_security_struct {
struct super_block *sb; /* back pointer to sb object */
struct list_head list; /* list of superblock_security_struct */
u32 sid; /* SID of file system superblock */
u32 def_sid; /* default SID for labeling */
u32 mntpoint_sid; /* SECURITY_FS_USE_MNTPOINT context for files */
Expand Down

0 comments on commit 1878240

Please sign in to comment.