]> git.karo-electronics.de Git - karo-tx-linux.git/commit
netfilter: xtables: fix reentrancy
authorEric Dumazet <eric.dumazet@gmail.com>
Sun, 20 Mar 2011 14:40:06 +0000 (15:40 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 14 Apr 2011 20:02:31 +0000 (13:02 -0700)
commit53a080a724fd79d44132cc6e2f08246021503622
tree127b2271529b60672548ec195aa9df9be458c885
parentebb12d3d3feb70061157ec5f71d7366f7b6e6dd9
netfilter: xtables: fix reentrancy

commit db856674ac69e31946e56085239757cca3f7655f upstream.

commit f3c5c1bfd4308 (make ip_tables reentrant) introduced a race in
handling the stackptr restore, at the end of ipt_do_table()

We should do it before the call to xt_info_rdunlock_bh(), or we allow
cpu preemption and another cpu overwrites stackptr of original one.

A second fix is to change the underflow test to check the origptr value
instead of 0 to detect underflow, or else we allow a jump from different
hooks.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Jan Engelhardt <jengelh@medozas.de>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
net/ipv4/netfilter/ip_tables.c
net/ipv6/netfilter/ip6_tables.c