From: Patrick McHardy <kaber@trash.net>
To: Raivis Bucis <raivis@mt.lv>
Cc: netfilter-devel <netfilter-devel@lists.netfilter.org>
Subject: Re: kernel crash [problem with helpers]
Date: Thu, 27 May 2004 02:34:28 +0200 [thread overview]
Message-ID: <40B53794.7060600@trash.net> (raw)
In-Reply-To: <200405261412.32587.raivis@mt.lv>
[-- Attachment #1: Type: text/plain, Size: 1832 bytes --]
Raivis Bucis wrote:
> ip_conntrack assumes that expect->expectant->helper allways will be non null,
> but that is not allways the case.
>
> When tftp conntrack is used, on first received UDP packet, tfp helper adds
> expectation. If it gets NATed later to some other port,
> ip_conntrack_alter_reply will set its helper to NULL, but expectation is
> still kept, and when expected conntrack is created, its master conntrack
> doesn't have helper anymore. This leads to kernel oops in list_conntracks
> when reading "/proc/net/ip_conntrack", etc.
Thanks for tracking this down.
>
> Therefore I propose following fix:
>
> diff -u -r1.13 ip_conntrack_core.c
> --- ip_conntrack_core.c 9 Jan 2004 07:52:10 -0000 1.13
> +++ ip_conntrack_core.c 26 May 2004 11:05:23 -0000
> @@ -1139,10 +1139,13 @@
> DUMP_TUPLE(newreply);
>
> conntrack->tuplehash[IP_CT_DIR_REPLY].tuple = *newreply;
> - if (!conntrack->master)
> - conntrack->helper = LIST_FIND(&helpers, helper_cmp,
> - struct ip_conntrack_helper *,
> - newreply);
> + if (!conntrack->master) {
> + struct ip_conntrack_helper *newhelper;
> + newhelper = LIST_FIND(&helpers, helper_cmp,
> + struct ip_conntrack_helper *,
> + newreply);
> + if (newhelper) conntrack->helper = newhelper;
> + }
> WRITE_UNLOCK(&ip_conntrack_lock);
>
> return 1;
>
>
> Or maybe, we should check whether it has expectations before looking for new
> helper.
Yes, your second solution is better. Changing helpers is fine as long as
no expectations exist. I have added this patch instead.
Regards
Patrick
>
> Raivis Bucis
[-- Attachment #2: linux.patch --]
[-- Type: text/x-patch, Size: 1063 bytes --]
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/05/27 02:01:28+02:00 kaber@trash.net
# [NETFILTER]: Don't assign new helper after NAT when there are already expectations present
#
# net/ipv4/netfilter/ip_conntrack_core.c
# 2004/05/27 02:01:19+02:00 kaber@trash.net +2 -4
# [NETFILTER]: Don't assign new helper after NAT when there are already expectations present
#
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-05-27 02:03:11 +02:00
+++ b/net/ipv4/netfilter/ip_conntrack_core.c 2004-05-27 02:03:11 +02:00
@@ -1127,10 +1127,8 @@
DUMP_TUPLE(newreply);
conntrack->tuplehash[IP_CT_DIR_REPLY].tuple = *newreply;
- if (!conntrack->master)
- conntrack->helper = LIST_FIND(&helpers, helper_cmp,
- struct ip_conntrack_helper *,
- newreply);
+ if (!conntrack->master && list_empty(&conntrack->sibling_list))
+ conntrack->helper = ip_ct_find_helper(newreply);
WRITE_UNLOCK(&ip_conntrack_lock);
return 1;
prev parent reply other threads:[~2004-05-27 0:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-05-26 11:12 kernel crash [problem with helpers] Raivis Bucis
2004-05-27 0:34 ` Patrick McHardy [this message]
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=40B53794.7060600@trash.net \
--to=kaber@trash.net \
--cc=netfilter-devel@lists.netfilter.org \
--cc=raivis@mt.lv \
/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.