From: Pablo Neira <pablo@eurodev.net>
To: Netfilter Development Mailinglist <netfilter-devel@lists.netfilter.org>
Cc: Eric Lemoine <eric.lemoine@gmail.com>
Subject: [PATCH] fix stats in __ip_conntrack_confirm
Date: Thu, 21 Oct 2004 00:30:03 +0200 [thread overview]
Message-ID: <4176E6EB.1070008@eurodev.net> (raw)
[-- 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;
}
next reply other threads:[~2004-10-20 22:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-10-20 22:30 Pablo Neira [this message]
2004-10-24 23:12 ` [PATCH] fix stats in __ip_conntrack_confirm Patrick McHardy
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=4176E6EB.1070008@eurodev.net \
--to=pablo@eurodev.net \
--cc=eric.lemoine@gmail.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.