: fix stats in __ip_conntrack_confirm
PATCH 19/19 : fix stats in __ip_conntrack_confirm
net_rx_softirq can preempt the calling process while incrementing the stats, call CONNTRACK_STAT_INC within the locked section.
# This is a BitKeeper generated diff -Nru style patch. #
# ChangeSet
# 2004/10/25 01:11:17+02:00 [email protected]
# [NETFILTER]: fix stats in __ip_conntrack_confirm
#
# net_rx_softirq can preempt the calling process while incrementing the stats. # I think that we can fix this moving both CONNTRACK_STAT_INC to the locked # section.
#
# Signed-off-by: Pablo Neira Ayuso <[email protected]>
# Signed-off-by: Patrick McHardy <[email protected]>
#
# net/ipv4/netfilter/ip_conntrack_core.c # 2004/10/25 01:11:10+02:00 [email protected] +3 -2 # [NETFILTER]: fix stats in __ip_conntrack_confirm # # net_rx_softirq can preempt the calling process while incrementing the stats. # I think that we can fix this moving both CONNTRACK_STAT_INC to the locked # section. # # Signed-off-by: Pablo Neira Ayuso <[email protected]> # Signed-off-by: Patrick McHardy <[email protected]> # diff -Nru a/net/ipv4/netfilter/ip_conntrack_core.c b/net/ipv4/netfilter/ip_conntrack_core.c --- a/net/ipv4/netfilter/ip_conntrack_core.c 2004-10-25 01:14:06 +02:00 +++ b/net/ipv4/netfilter/ip_conntrack_core.c 2004-10-25 01:14:06 +02:00 @@ -434,13 +434,14 @@ add_timer(&ct->timeout); atomic_inc(&ct->ct_general.use); set_bit(IPS_CONFIRMED_BIT, &ct->status); - WRITE_UNLOCK(&ip_conntrack_lock); CONNTRACK_STAT_INC(insert); + WRITE_UNLOCK(&ip_conntrack_lock); return NF_ACCEPT; }
- WRITE_UNLOCK(&ip_conntrack_lock);
CONNTRACK_STAT_INC(insert_failed);
+ WRITE_UNLOCK(&ip_conntrack_lock);
+
return NF_DROP;
}