diff mbox series

[4/5] netfilter: ipset: do not call ipset_nest_end after nla_nest_cancel

Message ID 20181210133938.6740-5-kadlec@blackhole.kfki.hu
State Accepted
Delegated to: Pablo Neira
Headers show
Series [1/5] netfilter: ipset: Allow matching on destination MAC address for mac and ipmac sets | expand

Commit Message

Jozsef Kadlecsik Dec. 10, 2018, 1:39 p.m. UTC
From: Pan Bian <bianpan2016@163.com>

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>
Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
---
 net/netfilter/ipset/ip_set_list_set.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Pablo Neira Ayuso Dec. 12, 2018, 11:48 p.m. UTC | #1
On Mon, Dec 10, 2018 at 02:39:37PM +0100, Jozsef Kadlecsik wrote:
> From: Pan Bian <bianpan2016@163.com>
> 
> 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>
> Signed-off-by: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>

Applied to nf.git, thanks Jozsef.
diff mbox series

Patch

diff --git a/net/netfilter/ipset/ip_set_list_set.c b/net/netfilter/ipset/ip_set_list_set.c
index 4eef55da0878..8da228da53ae 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;