All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix stats in __ip_conntrack_confirm
@ 2004-10-20 22:30 Pablo Neira
  2004-10-24 23:12 ` Patrick McHardy
  0 siblings, 1 reply; 2+ messages in thread
From: Pablo Neira @ 2004-10-20 22:30 UTC (permalink / raw)
  To: Netfilter Development Mailinglist; +Cc: Eric Lemoine

[-- Attachment #1: Type: text/plain, Size: 399 bytes --]

Hi,

I've been discussing this with Eric. __ip_conntrack_confirm is entered from
both process context and net_rx_softirq context and "++" operations aren't
atomic.

So 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.

regards,
Pablo

Signed-off-by: Pablo Neira Ayuso <pablo@eurodev.net>

[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 610 bytes --]

===== net/ipv4/netfilter/ip_conntrack_core.c 1.62 vs edited =====
--- 1.62/net/ipv4/netfilter/ip_conntrack_core.c	Mon Oct  4 01:23:58 2004
+++ edited/net/ipv4/netfilter/ip_conntrack_core.c	Mon Oct 18 21:53:02 2004
@@ -490,13 +490,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;
 }
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] fix stats in __ip_conntrack_confirm
  2004-10-20 22:30 [PATCH] fix stats in __ip_conntrack_confirm Pablo Neira
@ 2004-10-24 23:12 ` Patrick McHardy
  0 siblings, 0 replies; 2+ messages in thread
From: Patrick McHardy @ 2004-10-24 23:12 UTC (permalink / raw)
  To: Pablo Neira; +Cc: Netfilter Development Mailinglist, Eric Lemoine

Pablo Neira wrote:

> So 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.

Applied, thanks Pablo.

Regards
Patrick

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-10-24 23:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-20 22:30 [PATCH] fix stats in __ip_conntrack_confirm Pablo Neira
2004-10-24 23:12 ` Patrick McHardy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.