All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: "David S. Miller" <davem@redhat.com>
Cc: Netfilter Development Mailinglist <netfilter-devel@lists.netfilter.org>
Subject: [PATCH 2.6 19/19]: fix stats in __ip_conntrack_confirm
Date: Mon, 25 Oct 2004 02:50:11 +0200	[thread overview]
Message-ID: <417C4DC3.3060604@trash.net> (raw)

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

net_rx_softirq can preempt the calling process while incrementing the stats,
call CONNTRACK_STAT_INC within the locked section.



[-- Attachment #2: 19.diff --]
[-- Type: text/x-patch, Size: 1543 bytes --]

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/10/25 01:11:17+02:00 pablo@eurodev.net 
#   [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 <pablo@eurodev.net>
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
# 
# net/ipv4/netfilter/ip_conntrack_core.c
#   2004/10/25 01:11:10+02:00 pablo@eurodev.net +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 <pablo@eurodev.net>
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
# 
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;
 }
 

                 reply	other threads:[~2004-10-25  0:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=417C4DC3.3060604@trash.net \
    --to=kaber@trash.net \
    --cc=davem@redhat.com \
    --cc=netfilter-devel@lists.netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.