* [PATCH]: fix ipt_helper locking
@ 2003-07-12 10:44 Patrick McHardy
2003-07-14 7:55 ` Harald Welte
0 siblings, 1 reply; 2+ messages in thread
From: Patrick McHardy @ 2003-07-12 10:44 UTC (permalink / raw)
To: gandalf; +Cc: netfilter-devel
[-- Attachment #1: Type: TEXT/PLAIN, Size: 144 bytes --]
Hi Martin,
this patch fixes locking of ipt_helper. We need to hold ip_conntrack_lock
when dereferencing exp->expectant.
Best regards,
Patrick
[-- Attachment #2: Type: TEXT/plain, Size: 2210 bytes --]
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.1213 -> 1.1214
# net/ipv4/netfilter/ipt_helper.c 1.1 -> 1.2
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/07/12 kaber@trash.net 1.1214
# [NETFILTER]: Fix ipt_helper locking (must hold ip_conntrack_lock when dereferencing exp->expectant).
# --------------------------------------------
#
diff -Nru a/net/ipv4/netfilter/ipt_helper.c b/net/ipv4/netfilter/ipt_helper.c
--- a/net/ipv4/netfilter/ipt_helper.c Sat Jul 12 04:57:37 2003
+++ b/net/ipv4/netfilter/ipt_helper.c Sat Jul 12 04:57:37 2003
@@ -10,6 +10,7 @@
#include <linux/module.h>
#include <linux/skbuff.h>
#include <linux/netfilter_ipv4/ip_conntrack.h>
+#include <linux/netfilter_ipv4/ip_conntrack_core.h>
#include <linux/netfilter_ipv4/ip_conntrack_helper.h>
#include <linux/netfilter_ipv4/ip_tables.h>
#include <linux/netfilter_ipv4/ipt_helper.h>
@@ -36,6 +37,7 @@
struct ip_conntrack_expect *exp;
struct ip_conntrack *ct;
enum ip_conntrack_info ctinfo;
+ int ret = 0;
ct = ip_conntrack_get((struct sk_buff *)skb, &ctinfo);
if (!ct) {
@@ -49,23 +51,27 @@
}
exp = ct->master;
+ READ_LOCK(&ip_conntrack_lock);
if (!exp->expectant) {
DEBUGP("ipt_helper: expectation %p without expectant !?!\n",
exp);
- return 0;
+ goto out_unlock;
}
if (!exp->expectant->helper) {
DEBUGP("ipt_helper: master ct %p has no helper\n",
exp->expectant);
- return 0;
+ goto out_unlock;
}
DEBUGP("master's name = %s , info->name = %s\n",
exp->expectant->helper->name, info->name);
- return !strncmp(exp->expectant->helper->name, info->name,
- strlen(exp->expectant->helper->name)) ^ info->invert;
+ ret = !strncmp(exp->expectant->helper->name, info->name,
+ strlen(exp->expectant->helper->name)) ^ info->invert;
+out_unlock:
+ READ_UNLOCK(&ip_conntrack_lock);
+ return ret;
}
static int check(const char *tablename,
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH]: fix ipt_helper locking
2003-07-12 10:44 [PATCH]: fix ipt_helper locking Patrick McHardy
@ 2003-07-14 7:55 ` Harald Welte
0 siblings, 0 replies; 2+ messages in thread
From: Harald Welte @ 2003-07-14 7:55 UTC (permalink / raw)
To: Patrick McHardy; +Cc: gandalf, netfilter-devel
[-- Attachment #1: Type: text/plain, Size: 696 bytes --]
On Sat, Jul 12, 2003 at 12:44:30PM +0200, Patrick McHardy wrote:
> Hi Martin,
> this patch fixes locking of ipt_helper. We need to hold ip_conntrack_lock
> when dereferencing exp->expectant.
Thanks, I'll apply it to CVS once I return to some IP connectivity (I'm
travelling right now)
> Best regards,
> Patrick
--
- Harald Welte <laforge@netfilter.org> http://www.netfilter.org/
============================================================================
"Fragmentation is like classful addressing -- an interesting early
architectural error that shows how much experimentation was going
on while IP was being designed." -- Paul Vixie
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-07-14 7:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-07-12 10:44 [PATCH]: fix ipt_helper locking Patrick McHardy
2003-07-14 7:55 ` Harald Welte
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.