linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] netlabel_domainhash.c: Use built-in RCU list checking
@ 2020-02-18 18:41 madhuparnabhowmik10
  2020-02-18 20:44 ` David Miller
  2020-02-18 22:50 ` Paul Moore
  0 siblings, 2 replies; 3+ messages in thread
From: madhuparnabhowmik10 @ 2020-02-18 18:41 UTC (permalink / raw)
  To: paul, davem
  Cc: netdev, linux-security-module, linux-kernel, joel, frextrite,
	linux-kernel-mentees, paulmck, Madhuparna Bhowmik

From: Madhuparna Bhowmik <madhuparnabhowmik10@gmail.com>

list_for_each_entry_rcu() has built-in RCU and lock checking.

Pass cond argument to list_for_each_entry_rcu() to silence
false lockdep warning when CONFIG_PROVE_RCU_LIST is enabled
by default.

Signed-off-by: Madhuparna Bhowmik <madhuparnabhowmik10@gmail.com>
---
 net/netlabel/netlabel_domainhash.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/netlabel/netlabel_domainhash.c b/net/netlabel/netlabel_domainhash.c
index f5d34da0646e..a1f2320ecc16 100644
--- a/net/netlabel/netlabel_domainhash.c
+++ b/net/netlabel/netlabel_domainhash.c
@@ -143,7 +143,8 @@ static struct netlbl_dom_map *netlbl_domhsh_search(const char *domain,
 	if (domain != NULL) {
 		bkt = netlbl_domhsh_hash(domain);
 		bkt_list = &netlbl_domhsh_rcu_deref(netlbl_domhsh)->tbl[bkt];
-		list_for_each_entry_rcu(iter, bkt_list, list)
+		list_for_each_entry_rcu(iter, bkt_list, list,
+					lockdep_is_held(&netlbl_domhsh_lock))
 			if (iter->valid &&
 			    netlbl_family_match(iter->family, family) &&
 			    strcmp(iter->domain, domain) == 0)
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] netlabel_domainhash.c: Use built-in RCU list checking
  2020-02-18 18:41 [PATCH] netlabel_domainhash.c: Use built-in RCU list checking madhuparnabhowmik10
@ 2020-02-18 20:44 ` David Miller
  2020-02-18 22:50 ` Paul Moore
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2020-02-18 20:44 UTC (permalink / raw)
  To: madhuparnabhowmik10
  Cc: paul, netdev, linux-security-module, linux-kernel, joel,
	frextrite, linux-kernel-mentees, paulmck

From: madhuparnabhowmik10@gmail.com
Date: Wed, 19 Feb 2020 00:11:32 +0530

> From: Madhuparna Bhowmik <madhuparnabhowmik10@gmail.com>
> 
> list_for_each_entry_rcu() has built-in RCU and lock checking.
> 
> Pass cond argument to list_for_each_entry_rcu() to silence
> false lockdep warning when CONFIG_PROVE_RCU_LIST is enabled
> by default.
> 
> Signed-off-by: Madhuparna Bhowmik <madhuparnabhowmik10@gmail.com>

Applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] netlabel_domainhash.c: Use built-in RCU list checking
  2020-02-18 18:41 [PATCH] netlabel_domainhash.c: Use built-in RCU list checking madhuparnabhowmik10
  2020-02-18 20:44 ` David Miller
@ 2020-02-18 22:50 ` Paul Moore
  1 sibling, 0 replies; 3+ messages in thread
From: Paul Moore @ 2020-02-18 22:50 UTC (permalink / raw)
  To: madhuparnabhowmik10
  Cc: davem, netdev, linux-security-module, linux-kernel, joel,
	frextrite, linux-kernel-mentees, paulmck

On Tue, Feb 18, 2020 at 1:42 PM <madhuparnabhowmik10@gmail.com> wrote:
>
> From: Madhuparna Bhowmik <madhuparnabhowmik10@gmail.com>
>
> list_for_each_entry_rcu() has built-in RCU and lock checking.
>
> Pass cond argument to list_for_each_entry_rcu() to silence
> false lockdep warning when CONFIG_PROVE_RCU_LIST is enabled
> by default.
>
> Signed-off-by: Madhuparna Bhowmik <madhuparnabhowmik10@gmail.com>
> ---
>  net/netlabel/netlabel_domainhash.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Same as with the other patch.

Acked-by: Paul Moore <paul@paul-moore.com>

> diff --git a/net/netlabel/netlabel_domainhash.c b/net/netlabel/netlabel_domainhash.c
> index f5d34da0646e..a1f2320ecc16 100644
> --- a/net/netlabel/netlabel_domainhash.c
> +++ b/net/netlabel/netlabel_domainhash.c
> @@ -143,7 +143,8 @@ static struct netlbl_dom_map *netlbl_domhsh_search(const char *domain,
>         if (domain != NULL) {
>                 bkt = netlbl_domhsh_hash(domain);
>                 bkt_list = &netlbl_domhsh_rcu_deref(netlbl_domhsh)->tbl[bkt];
> -               list_for_each_entry_rcu(iter, bkt_list, list)
> +               list_for_each_entry_rcu(iter, bkt_list, list,
> +                                       lockdep_is_held(&netlbl_domhsh_lock))
>                         if (iter->valid &&
>                             netlbl_family_match(iter->family, family) &&
>                             strcmp(iter->domain, domain) == 0)
> --
> 2.17.1

-- 
paul moore
www.paul-moore.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-02-18 22:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-18 18:41 [PATCH] netlabel_domainhash.c: Use built-in RCU list checking madhuparnabhowmik10
2020-02-18 20:44 ` David Miller
2020-02-18 22:50 ` Paul Moore

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).