]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
netfilter: nf_conntrack: fix count leak in error path of __nf_conntrack_alloc
authorPablo Neira Ayuso <pablo@netfilter.org>
Tue, 3 Apr 2012 14:45:54 +0000 (16:45 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 3 Apr 2012 23:20:30 +0000 (19:20 -0400)
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>
net/netfilter/nf_conntrack_core.c

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