diff options
author | Casey Schaufler <casey@schaufler-ca.com> | 2012-05-23 17:46:58 -0700 |
---|---|---|
committer | Casey Schaufler <casey@schaufler-ca.com> | 2012-07-13 15:49:23 -0700 |
commit | eb982cb4cf6405b97ea1f9e1d10864981f269d46 (patch) | |
tree | 8d89448e0ef96d587ea8052021a721e632b4b318 /security/smack/smack_lsm.c | |
parent | 417c6c8ee2eb6975f357d8975af94ba5fbeaf82d (diff) | |
download | linux-eb982cb4cf6405b97ea1f9e1d10864981f269d46.tar.gz linux-eb982cb4cf6405b97ea1f9e1d10864981f269d46.tar.bz2 linux-eb982cb4cf6405b97ea1f9e1d10864981f269d46.zip |
Smack: fix smack_new_inode bogosities
In January of 2012 Al Viro pointed out three bits of code that
he titled "new_inode_smack bogosities". This patch repairs these
errors.
1. smack_sb_kern_mount() included a NULL check that is impossible.
The check and NULL case are removed.
2. smack_kb_kern_mount() included pointless locking. The locking is
removed. Since this is the only place that lock was used the lock
is removed from the superblock_smack structure.
3. smk_fill_super() incorrectly and unnecessarily set the Smack label
for the smackfs root inode. The assignment has been removed.
Targeted for git://gitorious.org/smack-next/kernel.git
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
Diffstat (limited to 'security/smack/smack_lsm.c')
-rw-r--r-- | security/smack/smack_lsm.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index ee0bb5735f35..29bb4e7fa5e8 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c @@ -251,7 +251,6 @@ static int smack_sb_alloc_security(struct super_block *sb) sbsp->smk_floor = smack_known_floor.smk_known; sbsp->smk_hat = smack_known_hat.smk_known; sbsp->smk_initialized = 0; - spin_lock_init(&sbsp->smk_sblock); sb->s_security = sbsp; @@ -332,13 +331,10 @@ static int smack_sb_kern_mount(struct super_block *sb, int flags, void *data) char *commap; char *nsp; - spin_lock(&sp->smk_sblock); - if (sp->smk_initialized != 0) { - spin_unlock(&sp->smk_sblock); + if (sp->smk_initialized != 0) return 0; - } + sp->smk_initialized = 1; - spin_unlock(&sp->smk_sblock); for (op = data; op != NULL; op = commap) { commap = strchr(op, ','); |