netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] netfilter: ipset: do not call ipset_nest_end after nla_nest_cancel
@ 2018-11-26 10:42 Pan Bian
  2018-12-01 16:40 ` Jozsef Kadlecsik
  0 siblings, 1 reply; 2+ messages in thread
From: Pan Bian @ 2018-11-26 10:42 UTC (permalink / raw)
  To: Pablo Neira Ayuso, Jozsef Kadlecsik, Florian Westphal,
	David S. Miller
  Cc: Stefano Brivio, netfilter-devel, coreteam, netdev, linux-kernel,
	Pan Bian

In the error handling block, nla_nest_cancel(skb, atd) is called to
cancel the nest operation. But then, ipset_nest_end(skb, atd) is
unexpected called to end the nest operation. This patch calls the
ipset_nest_end only on the branch that nla_nest_cancel is
not called.

Fixes: 45040978c89("netfilter: ipset: Fix set:list type crash when
flush/dump set in parallel")

Signed-off-by: Pan Bian <bianpan2016@163.com>
---
 net/netfilter/ipset/ip_set_list_set.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netfilter/ipset/ip_set_list_set.c b/net/netfilter/ipset/ip_set_list_set.c
index 4eef55d..8da228d 100644
--- a/net/netfilter/ipset/ip_set_list_set.c
+++ b/net/netfilter/ipset/ip_set_list_set.c
@@ -531,8 +531,8 @@ list_set_list(const struct ip_set *set,
 		ret = -EMSGSIZE;
 	} else {
 		cb->args[IPSET_CB_ARG0] = i;
+		ipset_nest_end(skb, atd);
 	}
-	ipset_nest_end(skb, atd);
 out:
 	rcu_read_unlock();
 	return ret;
-- 
2.7.4

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

* Re: [PATCH] netfilter: ipset: do not call ipset_nest_end after nla_nest_cancel
  2018-11-26 10:42 [PATCH] netfilter: ipset: do not call ipset_nest_end after nla_nest_cancel Pan Bian
@ 2018-12-01 16:40 ` Jozsef Kadlecsik
  0 siblings, 0 replies; 2+ messages in thread
From: Jozsef Kadlecsik @ 2018-12-01 16:40 UTC (permalink / raw)
  To: Pan Bian
  Cc: Pablo Neira Ayuso, Florian Westphal, David S. Miller,
	Stefano Brivio, netfilter-devel, coreteam, netdev, linux-kernel

Hi,

On Mon, 26 Nov 2018, Pan Bian wrote:

> In the error handling block, nla_nest_cancel(skb, atd) is called to
> cancel the nest operation. But then, ipset_nest_end(skb, atd) is
> unexpected called to end the nest operation. This patch calls the
> ipset_nest_end only on the branch that nla_nest_cancel is
> not called.
> 
> Fixes: 45040978c89("netfilter: ipset: Fix set:list type crash when
> flush/dump set in parallel")

Good catch, thank you. Patch is applied in ipset git tree.

Best regards,
Jozsef

> Signed-off-by: Pan Bian <bianpan2016@163.com>
> ---
>  net/netfilter/ipset/ip_set_list_set.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/netfilter/ipset/ip_set_list_set.c b/net/netfilter/ipset/ip_set_list_set.c
> index 4eef55d..8da228d 100644
> --- a/net/netfilter/ipset/ip_set_list_set.c
> +++ b/net/netfilter/ipset/ip_set_list_set.c
> @@ -531,8 +531,8 @@ list_set_list(const struct ip_set *set,
>  		ret = -EMSGSIZE;
>  	} else {
>  		cb->args[IPSET_CB_ARG0] = i;
> +		ipset_nest_end(skb, atd);
>  	}
> -	ipset_nest_end(skb, atd);
>  out:
>  	rcu_read_unlock();
>  	return ret;
> -- 
> 2.7.4
> 
> 
> 

-
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

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

end of thread, other threads:[~2018-12-01 16:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-26 10:42 [PATCH] netfilter: ipset: do not call ipset_nest_end after nla_nest_cancel Pan Bian
2018-12-01 16:40 ` Jozsef Kadlecsik

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