mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Casey Schaufler <casey@schaufler-ca.com>
To: Casey Schaufler <casey@schaufler-ca.com>
Cc: Al Viro <viro@ZenIV.linux.org.uk>,
	LKLM <linux-kernel@vger.kernel.org>,
	LSM <linux-security-module@vger.kernel.org>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH] Smack: fix smack_new_inode bogosities
Date: Sun, 27 May 2012 14:32:50 -0700	[thread overview]
Message-ID: <4FC29D82.5040101@schaufler-ca.com> (raw)
In-Reply-To: <4FBD8502.4010602@schaufler-ca.com>

On 5/23/2012 5:46 PM, Casey Schaufler wrote:
> From: Casey Schaufler <casey@schaufler-ca.com>
> Subject: [PATCH] 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>


Applied to git://gitorious.org/smack-next/kernel.git

>
> ---
>
>  security/smack/smack.h     |    1 -
>  security/smack/smack_lsm.c |    8 ++------
>  security/smack/smackfs.c   |    1 -
>  3 files changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/security/smack/smack.h b/security/smack/smack.h
> index cc361b8..76feb31 100644
> --- a/security/smack/smack.h
> +++ b/security/smack/smack.h
> @@ -43,7 +43,6 @@ struct superblock_smack {
>  	char		*smk_hat;
>  	char		*smk_default;
>  	int		smk_initialized;
> -	spinlock_t	smk_sblock;	/* for initialization */
>  };
>  
>  struct socket_smack {
> diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
> index d583c05..5a4d52c 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, ',');
> diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c
> index 1810c9a..3686db7 100644
> --- a/security/smack/smackfs.c
> +++ b/security/smack/smackfs.c
> @@ -2051,7 +2051,6 @@ static int smk_fill_super(struct super_block *sb, void *data, int silent)
>  	}
>  
>  	root_inode = sb->s_root->d_inode;
> -	root_inode->i_security = new_inode_smack(smack_known_floor.smk_known);
>  
>  	return 0;
>  }
>
>
>
>


      reply	other threads:[~2012-05-27 21:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-24  0:46 Casey Schaufler
2012-05-27 21:32 ` Casey Schaufler [this message]

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=4FC29D82.5040101@schaufler-ca.com \
    --to=casey@schaufler-ca.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=viro@ZenIV.linux.org.uk \
    /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

Powered by JetHome