From: Harald Welte <laforge@netfilter.org> To: David Miller <davem@redhat.com> Cc: Netfilter Development Mailinglist <netfilter-devel@lists.netfilter.org>, Linux Kernel Mailinglist <linux-kernel@vger.kernel.org> Subject: [PATCH 2.6] netfilter ipt_helper locking fix Date: Fri, 25 Jul 2003 22:52:26 +0200 [thread overview] Message-ID: <20030725205226.GC3244@sunbeam.de.gnumonks.org> (raw) [-- Attachment #1: Type: text/plain, Size: 2546 bytes --] Hi Dave! This is the 4th of my 2.6 merge of recent bugfixes (all tested against 2.4.22-pre7). You might need to apply them incrementally (didn't test it in a different order). Author: Patrick McHardy <kaber@trash.net> Fix locking of ipt_helper. Please apply, diff -Nru --exclude .depend --exclude '*.o' --exclude '*.ko' --exclude '*.ver' --exclude '.*.flags' --exclude '*.orig' --exclude '*.rej' --exclude '*.cmd' --exclude '*.mod.c' --exclude '*~' linux-2.6.0-test1-nftest3/net/ipv4/netfilter/ipt_helper.c linux-2.6.0-test1-nftest4/net/ipv4/netfilter/ipt_helper.c --- linux-2.6.0-test1-nftest3/net/ipv4/netfilter/ipt_helper.c 2003-07-14 05:36:42.000000000 +0200 +++ linux-2.6.0-test1-nftest4/net/ipv4/netfilter/ipt_helper.c 2003-07-19 16:32:30.000000000 +0200 @@ -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> @@ -34,6 +35,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) { @@ -47,23 +49,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, -- - 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 --]
reply other threads:[~2003-07-25 20:43 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=20030725205226.GC3244@sunbeam.de.gnumonks.org \ --to=laforge@netfilter.org \ --cc=davem@redhat.com \ --cc=linux-kernel@vger.kernel.org \ --cc=netfilter-devel@lists.netfilter.org \ --subject='Re: [PATCH 2.6] netfilter ipt_helper locking fix' \ /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
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).