netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4/8] netfilter: Add missing annotation for ctnetlink_parse_nat_setup()
       [not found] ` <20200311010908.42366-1-jbi.octave@gmail.com>
@ 2020-03-11  1:09   ` Jules Irenge
  2020-03-27 17:22     ` Pablo Neira Ayuso
  2020-03-11  1:09   ` [PATCH 5/8] netfilter: conntrack: Add missing annotations for nf_conntrack_all_lock() and nf_conntrack_all_unlock() Jules Irenge
  1 sibling, 1 reply; 4+ messages in thread
From: Jules Irenge @ 2020-03-11  1:09 UTC (permalink / raw)
  To: boqun.feng
  Cc: linux-kernel, bpf, netdev, Pablo Neira Ayuso, Jozsef Kadlecsik,
	Florian Westphal, David S. Miller, Jakub Kicinski,
	open list:NETFILTER, open list:NETFILTER

Sparse reports a warning at ctnetlink_parse_nat_setup()

warning: context imbalance in ctnetlink_parse_nat_setup()
	- unexpected unlock

The root cause is the missing annotation at ctnetlink_parse_nat_setup()
Add the missing __must_hold(RCU) annotation

Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
---
 net/netfilter/nf_conntrack_netlink.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c
index 6a1c8f1f6171..eb190206cd12 100644
--- a/net/netfilter/nf_conntrack_netlink.c
+++ b/net/netfilter/nf_conntrack_netlink.c
@@ -1533,6 +1533,7 @@ static int
 ctnetlink_parse_nat_setup(struct nf_conn *ct,
 			  enum nf_nat_manip_type manip,
 			  const struct nlattr *attr)
+	__must_hold(RCU)
 {
 	struct nf_nat_hook *nat_hook;
 	int err;
-- 
2.24.1


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

* [PATCH 5/8] netfilter: conntrack: Add missing annotations for nf_conntrack_all_lock() and nf_conntrack_all_unlock()
       [not found] ` <20200311010908.42366-1-jbi.octave@gmail.com>
  2020-03-11  1:09   ` [PATCH 4/8] netfilter: Add missing annotation for ctnetlink_parse_nat_setup() Jules Irenge
@ 2020-03-11  1:09   ` Jules Irenge
  2020-03-27 17:22     ` Pablo Neira Ayuso
  1 sibling, 1 reply; 4+ messages in thread
From: Jules Irenge @ 2020-03-11  1:09 UTC (permalink / raw)
  To: boqun.feng
  Cc: linux-kernel, bpf, netdev, Pablo Neira Ayuso, Jozsef Kadlecsik,
	Florian Westphal, David S. Miller, Jakub Kicinski,
	open list:NETFILTER, open list:NETFILTER

Sparse reports warnings at nf_conntrack_all_lock()
	and nf_conntrack_all_unlock()

warning: context imbalance in nf_conntrack_all_lock()
	- wrong count at exit
warning: context imbalance in nf_conntrack_all_unlock()
	- unexpected unlock

Add the missing __acquires(&nf_conntrack_locks_all_lock)
Add missing __releases(&nf_conntrack_locks_all_lock)

Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
---
 net/netfilter/nf_conntrack_core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index d1305423640f..a0bc122d5df1 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -143,6 +143,7 @@ static bool nf_conntrack_double_lock(struct net *net, unsigned int h1,
 }
 
 static void nf_conntrack_all_lock(void)
+	__acquires(&nf_conntrack_locks_all_lock)
 {
 	int i;
 
@@ -162,6 +163,7 @@ static void nf_conntrack_all_lock(void)
 }
 
 static void nf_conntrack_all_unlock(void)
+	__releases(&nf_conntrack_locks_all_lock)
 {
 	/* All prior stores must be complete before we clear
 	 * 'nf_conntrack_locks_all'. Otherwise nf_conntrack_lock()
-- 
2.24.1


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

* Re: [PATCH 4/8] netfilter: Add missing annotation for ctnetlink_parse_nat_setup()
  2020-03-11  1:09   ` [PATCH 4/8] netfilter: Add missing annotation for ctnetlink_parse_nat_setup() Jules Irenge
@ 2020-03-27 17:22     ` Pablo Neira Ayuso
  0 siblings, 0 replies; 4+ messages in thread
From: Pablo Neira Ayuso @ 2020-03-27 17:22 UTC (permalink / raw)
  To: Jules Irenge
  Cc: boqun.feng, linux-kernel, bpf, netdev, Jozsef Kadlecsik,
	Florian Westphal, David S. Miller, Jakub Kicinski,
	open list:NETFILTER, open list:NETFILTER

On Wed, Mar 11, 2020 at 01:09:04AM +0000, Jules Irenge wrote:
> Sparse reports a warning at ctnetlink_parse_nat_setup()
> 
> warning: context imbalance in ctnetlink_parse_nat_setup()
> 	- unexpected unlock
> 
> The root cause is the missing annotation at ctnetlink_parse_nat_setup()
> Add the missing __must_hold(RCU) annotation

Applied, thanks.

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

* Re: [PATCH 5/8] netfilter: conntrack: Add missing annotations for nf_conntrack_all_lock() and nf_conntrack_all_unlock()
  2020-03-11  1:09   ` [PATCH 5/8] netfilter: conntrack: Add missing annotations for nf_conntrack_all_lock() and nf_conntrack_all_unlock() Jules Irenge
@ 2020-03-27 17:22     ` Pablo Neira Ayuso
  0 siblings, 0 replies; 4+ messages in thread
From: Pablo Neira Ayuso @ 2020-03-27 17:22 UTC (permalink / raw)
  To: Jules Irenge
  Cc: boqun.feng, linux-kernel, bpf, netdev, Jozsef Kadlecsik,
	Florian Westphal, David S. Miller, Jakub Kicinski,
	open list:NETFILTER, open list:NETFILTER

On Wed, Mar 11, 2020 at 01:09:05AM +0000, Jules Irenge wrote:
> Sparse reports warnings at nf_conntrack_all_lock()
> 	and nf_conntrack_all_unlock()
> 
> warning: context imbalance in nf_conntrack_all_lock()
> 	- wrong count at exit
> warning: context imbalance in nf_conntrack_all_unlock()
> 	- unexpected unlock
> 
> Add the missing __acquires(&nf_conntrack_locks_all_lock)
> Add missing __releases(&nf_conntrack_locks_all_lock)

Also applied, thanks.

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

end of thread, other threads:[~2020-03-27 17:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <0/8>
     [not found] ` <20200311010908.42366-1-jbi.octave@gmail.com>
2020-03-11  1:09   ` [PATCH 4/8] netfilter: Add missing annotation for ctnetlink_parse_nat_setup() Jules Irenge
2020-03-27 17:22     ` Pablo Neira Ayuso
2020-03-11  1:09   ` [PATCH 5/8] netfilter: conntrack: Add missing annotations for nf_conntrack_all_lock() and nf_conntrack_all_unlock() Jules Irenge
2020-03-27 17:22     ` Pablo Neira Ayuso

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