linux/net/ipv4/netfilter
Pavel Emelyanov 4dee959723 [NETFILTER]: ipt_CLUSTERIP: fix race between clusterip_config_find_get and _entry_put
Consider we are putting a clusterip_config entry with the "entries"
count == 1, and on the other CPU there's a clusterip_config_find_get
in progress:

CPU1:							CPU2:
clusterip_config_entry_put:				clusterip_config_find_get:
if (atomic_dec_and_test(&c->entries)) {
	/* true */
							read_lock_bh(&clusterip_lock);
							c = __clusterip_config_find(clusterip);
							/* found - it's still in list */
							...
							atomic_inc(&c->entries);
							read_unlock_bh(&clusterip_lock);

	write_lock_bh(&clusterip_lock);
	list_del(&c->list);
	write_unlock_bh(&clusterip_lock);
	...
	dev_put(c->dev);

Oops! We have an entry returned by the clusterip_config_find_get,
which is a) not in list b) has a stale dev pointer.

The problems will happen when the CPU2 will release the entry - it
will remove it from the list for the 2nd time, thus spoiling it, and
will put a stale dev pointer.

The fix is to make atomic_dec_and_test under the clusterip_lock.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: Patrick McHardy <kaber@trash.net>
2008-04-14 00:44:52 -07:00
..
Kconfig [NETFILTER]: Rename ipt_iprange to xt_iprange 2008-01-28 15:02:27 -08:00
Makefile [NETFILTER]: Rename ipt_iprange to xt_iprange 2008-01-28 15:02:27 -08:00
arp_tables.c [NETFILTER]: x_tables: create per-netns /proc/net/*_tables_* 2008-01-31 19:28:06 -08:00
arpt_mangle.c [NETFILTER]: Fix incorrect use of skb_make_writable 2008-02-19 17:18:47 -08:00
arptable_filter.c [NETFILTER]: arp_tables: per-netns arp_tables FILTER 2008-01-31 19:27:41 -08:00
ip_queue.c [NETFILTER]: Replate direct proc_fops assignment with proc_create call. 2008-03-27 16:55:53 -07:00
ip_tables.c [NETFILTER]: x_tables: create per-netns /proc/net/*_tables_* 2008-01-31 19:28:06 -08:00
ipt_CLUSTERIP.c [NETFILTER]: ipt_CLUSTERIP: fix race between clusterip_config_find_get and _entry_put 2008-04-14 00:44:52 -07:00
ipt_ECN.c [NETFILTER]: Update modules' descriptions 2008-01-28 15:02:26 -08:00
ipt_LOG.c [NETFILTER]: Update modules' descriptions 2008-01-28 15:02:26 -08:00
ipt_MASQUERADE.c [NETFILTER]: Update modules' descriptions 2008-01-28 15:02:26 -08:00
ipt_NETMAP.c [NETFILTER]: Update modules' descriptions 2008-01-28 15:02:26 -08:00
ipt_REDIRECT.c [NETFILTER]: Update modules' descriptions 2008-01-28 15:02:26 -08:00
ipt_REJECT.c [NETFILTER]: ipt_REJECT: properly handle IP options 2008-01-28 15:02:30 -08:00
ipt_TTL.c [NETFILTER]: Update modules' descriptions 2008-01-28 15:02:26 -08:00
ipt_ULOG.c [NETNS]: Consolidate kernel netlink socket destruction. 2008-01-28 15:08:07 -08:00
ipt_addrtype.c [NETFILTER]: Update modules' descriptions 2008-01-28 15:02:26 -08:00
ipt_ah.c [NETFILTER]: Update modules' descriptions 2008-01-28 15:02:26 -08:00
ipt_ecn.c [NETFILTER]: Update modules' descriptions 2008-01-28 15:02:26 -08:00
ipt_recent.c [NETFILTER]: Replate direct proc_fops assignment with proc_create call. 2008-03-27 16:55:53 -07:00
ipt_ttl.c [NETFILTER]: Update modules' descriptions 2008-01-28 15:02:26 -08:00
iptable_filter.c [NETFILTER]: ip_tables: per-netns FILTER, MANGLE, RAW 2008-01-31 19:27:38 -08:00
iptable_mangle.c [NETFILTER]: ip_tables: per-netns FILTER, MANGLE, RAW 2008-01-31 19:27:38 -08:00
iptable_raw.c [NETFILTER]: ip_tables: per-netns FILTER, MANGLE, RAW 2008-01-31 19:27:38 -08:00
nf_conntrack_l3proto_ipv4.c [NETFILTER]: nf_conntrack: annotate l3protos with const 2008-01-31 19:28:13 -08:00
nf_conntrack_l3proto_ipv4_compat.c [NETFILTER]: Replate direct proc_fops assignment with proc_create call. 2008-03-27 16:55:53 -07:00
nf_conntrack_proto_icmp.c [NETFILTER]: nf_{conntrack,nat}_icmp: constify and annotate 2008-01-31 19:28:12 -08:00
nf_nat_amanda.c [NETFILTER]: remove unneeded rcu_dereference() calls 2007-11-07 04:08:23 -08:00
nf_nat_core.c [NETFILTER]: nf_nat: autoload IPv4 connection tracking 2008-04-09 15:14:58 -07:00
nf_nat_ftp.c [NETFILTER]: remove unneeded rcu_dereference() calls 2007-11-07 04:08:23 -08:00
nf_nat_h323.c [NETFILTER]: nf_conntrack_h323: constify and annotate H.323 helper 2008-01-31 19:28:07 -08:00
nf_nat_helper.c [NETFILTER]: nf_nat: fix sparse warning 2008-01-31 19:28:15 -08:00
nf_nat_irc.c [NETFILTER]: remove unneeded rcu_dereference() calls 2007-11-07 04:08:23 -08:00
nf_nat_pptp.c [NETFILTER]: nf_{conntrack,nat}_pptp: annotate PPtP helper with const 2008-01-31 19:28:09 -08:00
nf_nat_proto_gre.c [NETFILTER]: nf_{conntrack,nat}_proto_gre: annotate with const 2008-01-31 19:28:12 -08:00
nf_nat_proto_icmp.c [NETFILTER]: nf_{conntrack,nat}_icmp: constify and annotate 2008-01-31 19:28:12 -08:00
nf_nat_proto_tcp.c [NETFILTER]: nf_{conntrack,nat}_proto_tcp: constify and annotate TCP modules 2008-01-31 19:28:10 -08:00
nf_nat_proto_udp.c [NETFILTER]: nf_{conntrack,nat}_proto_udp{,lite}: annotate with const 2008-01-31 19:28:11 -08:00
nf_nat_proto_unknown.c [NETFILTER]: nf_nat: mark NAT protocols const 2008-01-28 14:58:56 -08:00
nf_nat_rule.c [NETFILTER]: x_tables: return new table from {arp,ip,ip6}t_register_table() 2008-01-31 19:27:36 -08:00
nf_nat_sip.c [NETFILTER]: nf_{conntrack,nat}_sip: annotate SIP helper with const 2008-01-31 19:28:08 -08:00
nf_nat_snmp_basic.c [NETFILTER]: nf_nat_snmp: sparse warning 2008-01-31 19:27:44 -08:00
nf_nat_standalone.c [NETFILTER]: nf_nat: properly use RCU for ip_nat_decode_session 2008-01-28 14:59:06 -08:00
nf_nat_tftp.c [NETFILTER]: nf_{conntrack,nat}_tftp: annotate TFTP helper with const 2008-01-31 19:28:08 -08:00