Эх сурвалжийг харах

netfilter: nf_conntrack: fix count leak in error path of __nf_conntrack_alloc

We have to decrement the conntrack counter if we fail to access the
zone extension.

Reported-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Pablo Neira Ayuso 13 жил өмнө
parent
commit
d96fc659ae

+ 1 - 0
net/netfilter/nf_conntrack_core.c

@@ -735,6 +735,7 @@ __nf_conntrack_alloc(struct net *net, u16 zone,
 
 
 #ifdef CONFIG_NF_CONNTRACK_ZONES
 #ifdef CONFIG_NF_CONNTRACK_ZONES
 out_free:
 out_free:
+	atomic_dec(&net->ct.count);
 	kmem_cache_free(net->ct.nf_conntrack_cachep, ct);
 	kmem_cache_free(net->ct.nf_conntrack_cachep, ct);
 	return ERR_PTR(-ENOMEM);
 	return ERR_PTR(-ENOMEM);
 #endif
 #endif