]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commit
[NETFILTER]: ip_conntrack_expect_related must not free expectation
authorRusty Russell <rusty@rustcorp.com.au>
Thu, 21 Jul 2005 20:14:46 +0000 (13:14 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 21 Jul 2005 20:14:46 +0000 (13:14 -0700)
commit4acdbdbe5089c06d5e0c7e96783fcc4414ded00a
tree77629aef70bd92983518b6f5dd13c70a222c4cbb
parent4aa49d130df9209707a97786a55a3f584b7345e9
[NETFILTER]: ip_conntrack_expect_related must not free expectation

If a connection tracking helper tells us to expect a connection, and
we're already expecting that connection, we simply free the one they
gave us and return success.

The problem is that NAT helpers (eg. FTP) have to allocate the
expectation first (to see what port is available) then rewrite the
packet.  If that rewrite fails, they try to remove the expectation,
but it was freed in ip_conntrack_expect_related.

This is one example of a larger problem: having registered the
expectation, the pointer is no longer ours to use.  Reference counting
is needed for ctnetlink anyway, so introduce it now.

To have a single "put" path, we need to grab the reference to the
connection on creation, rather than open-coding it in the caller.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
12 files changed:
include/linux/netfilter_ipv4/ip_conntrack.h
include/linux/netfilter_ipv4/ip_conntrack_helper.h
net/ipv4/netfilter/ip_conntrack_amanda.c
net/ipv4/netfilter/ip_conntrack_core.c
net/ipv4/netfilter/ip_conntrack_ftp.c
net/ipv4/netfilter/ip_conntrack_irc.c
net/ipv4/netfilter/ip_conntrack_standalone.c
net/ipv4/netfilter/ip_conntrack_tftp.c
net/ipv4/netfilter/ip_nat_amanda.c
net/ipv4/netfilter/ip_nat_ftp.c
net/ipv4/netfilter/ip_nat_irc.c
net/ipv4/netfilter/ip_nat_tftp.c