]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
netfilter: Fix kernel panic with REDIRECT target.
authorEvgeniy Polyakov <johnpol@2ka.mipt.ru>
Wed, 28 Nov 2007 08:56:54 +0000 (09:56 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 14 Dec 2007 17:51:02 +0000 (09:51 -0800)
commit0a16fc9e08ffcf546cd06e651d7d73fea8646fc5
tree51da3b320f64871f1a708b4a060734cd5c47da8f
parent1aa640f72f0275f30cba9ed8456e07824dd730ad
netfilter: Fix kernel panic with REDIRECT target.

This patch fixes a NAT regression in 2.6.23, resulting in a
crash when a connection is NATed and matches a conntrack
helper after NAT.

Please apply, thanks.
[NETFILTER]: Fix kernel panic with REDIRECT target.

Upstream commit 1f305323ff5b9ddc1a4346d36072bcdb58f3f68a

When connection tracking entry (nf_conn) is about to copy itself it can
have some of its extension users (like nat) as being already freed and
thus not required to be copied.

Actually looking at this function I suspect it was copied from
nf_nat_setup_info() and thus bug was introduced.

Report and testing from David <david@unsolicited.net>.

[ Patrick McHardy states:

        I now understand whats happening:

        - new connection is allocated without helper
        - connection is REDIRECTed to localhost
        - nf_nat_setup_info adds NAT extension, but doesn't initialize it yet
        - nf_conntrack_alter_reply performs a helper lookup based on the
           new tuple, finds the SIP helper and allocates a helper extension,
           causing reallocation because of too little space
        - nf_nat_move_storage is called with the uninitialized nat extension

        So your fix is entirely correct, thanks a lot :)  ]

Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Acked-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
net/ipv4/netfilter/nf_nat_core.c