linux-integrity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mimi Zohar <zohar@linux.vnet.ibm.com>
To: Petko Manolov <petkan@nucleusys.com>
Cc: Linux Integrity <linux-integrity@vger.kernel.org>
Subject: Re: [PATCH] IMA: use list_splice_tail_init_rcu() instead of its open coded variant
Date: Wed, 23 May 2018 11:37:56 -0400	[thread overview]
Message-ID: <1527089876.3364.5.camel@linux.vnet.ibm.com> (raw)
In-Reply-To: <20180522140655.GA5794@carbon>

Hi Petko,

On Tue, 2018-05-22 at 17:06 +0300, Petko Manolov wrote:

The patch description is missing.  Is the following ok?

Use list_splice_tail_init_rcu() to extend the existing custom IMA
policy with additional IMA policy rules.

Mimi

> 
> Signed-off-by: Petko Manolov <petko.manolov@konsulko.com>
> ---
>  security/integrity/ima/ima_policy.c | 17 ++---------------
>  1 file changed, 2 insertions(+), 15 deletions(-)
> 
> diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
> index d89bebf85421..722466f843ef 100644
> --- a/security/integrity/ima/ima_policy.c
> +++ b/security/integrity/ima/ima_policy.c
> @@ -509,22 +509,9 @@ int ima_check_policy(void)
>   */
>  void ima_update_policy(void)
>  {
> -	struct list_head *first, *last, *policy;
> +	struct list_head *policy = &ima_policy_rules;
> 
> -	/* append current policy with the new rules */
> -	first = (&ima_temp_rules)->next;
> -	last = (&ima_temp_rules)->prev;
> -	policy = &ima_policy_rules;
> -
> -	synchronize_rcu();
> -
> -	last->next = policy;
> -	rcu_assign_pointer(list_next_rcu(policy->prev), first);
> -	first->prev = policy->prev;
> -	policy->prev = last;
> -
> -	/* prepare for the next policy rules addition */
> -	INIT_LIST_HEAD(&ima_temp_rules);
> +	list_splice_tail_init_rcu(&ima_temp_rules, policy, synchronize_rcu);
> 
>  	if (ima_rules != policy) {
>  		ima_policy_flag = 0;

      reply	other threads:[~2018-05-23 15:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-22 14:06 [PATCH] IMA: use list_splice_tail_init_rcu() instead of its open coded variant Petko Manolov
2018-05-23 15:37 ` Mimi Zohar [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=1527089876.3364.5.camel@linux.vnet.ibm.com \
    --to=zohar@linux.vnet.ibm.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=petkan@nucleusys.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;
as well as URLs for NNTP newsgroup(s).