diff mbox series

[ipset,nf-next] netfilter: ipset: use nfnl_mutex_is_locked

Message ID 20171130200732.2814-1-fw@strlen.de
State Accepted
Delegated to: Pablo Neira
Headers show
Series [ipset,nf-next] netfilter: ipset: use nfnl_mutex_is_locked | expand

Commit Message

Florian Westphal Nov. 30, 2017, 8:07 p.m. UTC
Check that we really hold nfnl mutex here instead of relying on correct
usage alone.

Signed-off-by: Florian Westphal <fw@strlen.de>
---

Comments

Jozsef Kadlecsik Dec. 1, 2017, 7:14 p.m. UTC | #1
Hi Florian,

On Thu, 30 Nov 2017, Florian Westphal wrote:

> Check that we really hold nfnl mutex here instead of relying on correct
> usage alone.
> 
> Signed-off-by: Florian Westphal <fw@strlen.de>

Yes, it's better this way :-)

Acked-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>

> ---
> diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c
> index d5a43cad90f04..1f3c03b3bebf2 100644
> --- a/net/netfilter/ipset/ip_set_core.c
> +++ b/net/netfilter/ipset/ip_set_core.c
> @@ -57,7 +57,7 @@ MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_IPSET);
>  
>  /* When the nfnl mutex is held: */
>  #define ip_set_dereference(p)		\
> -	rcu_dereference_protected(p, 1)
> +	rcu_dereference_protected(p, lockdep_nfnl_is_held(NFNL_SUBSYS_IPSET))
>  #define ip_set(inst, id)		\
>  	ip_set_dereference((inst)->ip_set_list)[id]
>  
> -- 
> 2.14.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

-
E-mail  : kadlec@blackhole.kfki.hu, kadlecsik.jozsef@wigner.mta.hu
PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : Wigner Research Centre for Physics, Hungarian Academy of Sciences
          H-1525 Budapest 114, POB. 49, Hungary
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Pablo Neira Ayuso Dec. 6, 2017, 8:18 a.m. UTC | #2
On Fri, Dec 01, 2017 at 08:14:48PM +0100, Jozsef Kadlecsik wrote:
> Hi Florian,
> 
> On Thu, 30 Nov 2017, Florian Westphal wrote:
> 
> > Check that we really hold nfnl mutex here instead of relying on correct
> > usage alone.
> > 
> > Signed-off-by: Florian Westphal <fw@strlen.de>
> 
> Yes, it's better this way :-)
> 
> Acked-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox series

Patch

diff --git a/net/netfilter/ipset/ip_set_core.c b/net/netfilter/ipset/ip_set_core.c
index d5a43cad90f04..1f3c03b3bebf2 100644
--- a/net/netfilter/ipset/ip_set_core.c
+++ b/net/netfilter/ipset/ip_set_core.c
@@ -57,7 +57,7 @@  MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_IPSET);
 
 /* When the nfnl mutex is held: */
 #define ip_set_dereference(p)		\
-	rcu_dereference_protected(p, 1)
+	rcu_dereference_protected(p, lockdep_nfnl_is_held(NFNL_SUBSYS_IPSET))
 #define ip_set(inst, id)		\
 	ip_set_dereference((inst)->ip_set_list)[id]