All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: "David S. Miller" <davem@davemloft.net>
Cc: linux-net@vger.kernel.org, netfilter-devel@lists.netfilter.org,
	Herbert Xu <herbert@gondor.apana.org.au>,
	linux-kernel@vger.kernel.org
Subject: Re: [BK PATCH] Fix ip_conntrack_amanda data corruption bug that breaks amanda dumps
Date: Thu, 04 Nov 2004 22:53:11 +0100	[thread overview]
Message-ID: <418AA4C7.2030909@trash.net> (raw)
In-Reply-To: <20041104130028.099fc130.davem@davemloft.net>

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

David S. Miller wrote:

>You're right... the bug was introduced by my skb_header_pointer() changes.
>Look at this:
>
>	amp = skb_header_pointer(skb, dataoff,
>				 skb->len - dataoff, amanda_buffer);
>	BUG_ON(amp == NULL);
>	data = amp;
>	data_limit = amp + skb->len - dataoff;
>	*data_limit = '\0';
>
>It should just use the amanda_buffer always.
>
Thanks Dave and Herbert, here is the patch in case you haven't fixed it
already.

Regards
Patrick


[-- Attachment #2: x --]
[-- Type: text/plain, Size: 1813 bytes --]

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/11/04 22:50:11+01:00 kaber@coreworks.de 
#   [NETFILTER]: Don't use skb_header_pointer in amanda conntrack helper
#   
#   Fixes broken packets, noticed by Matthias Andree <matthias.andree@gmx.de>
#   
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
# 
# net/ipv4/netfilter/ip_conntrack_amanda.c
#   2004/11/04 22:50:04+01:00 kaber@coreworks.de +5 -7
#   [NETFILTER]: Don't use skb_header_pointer in amanda conntrack helper
#   
#   Fixes broken packets, noticed by Matthias Andree <matthias.andree@gmx.de>
#   
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
# 
diff -Nru a/net/ipv4/netfilter/ip_conntrack_amanda.c b/net/ipv4/netfilter/ip_conntrack_amanda.c
--- a/net/ipv4/netfilter/ip_conntrack_amanda.c	2004-11-04 22:50:37 +01:00
+++ b/net/ipv4/netfilter/ip_conntrack_amanda.c	2004-11-04 22:50:37 +01:00
@@ -49,7 +49,7 @@
 {
 	struct ip_conntrack_expect *exp;
 	struct ip_ct_amanda_expect *exp_amanda_info;
-	char *amp, *data, *data_limit, *tmp;
+	char *data, *data_limit, *tmp;
 	unsigned int dataoff, i;
 	u_int16_t port, len;
 
@@ -70,11 +70,9 @@
 	}
 
 	LOCK_BH(&amanda_buffer_lock);
-	amp = skb_header_pointer(skb, dataoff,
-				 skb->len - dataoff, amanda_buffer);
-	BUG_ON(amp == NULL);
-	data = amp;
-	data_limit = amp + skb->len - dataoff;
+	skb_copy_bits(skb, dataoff, amanda_buffer, skb->len - dataoff);
+	data = amanda_buffer;
+	data_limit = amanda_buffer + skb->len - dataoff;
 	*data_limit = '\0';
 
 	/* Search for the CONNECT string */
@@ -110,7 +108,7 @@
 		exp->mask.dst.u.tcp.port = 0xFFFF;
 
 		exp_amanda_info = &exp->help.exp_amanda_info;
-		exp_amanda_info->offset = tmp - amp;
+		exp_amanda_info->offset = tmp - amanda_buffer;
 		exp_amanda_info->port   = port;
 		exp_amanda_info->len    = len;
 

WARNING: multiple messages have this Message-ID (diff)
From: Patrick McHardy <kaber@trash.net>
To: "David S. Miller" <davem@davemloft.net>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	linux-net@vger.kernel.org, netfilter-devel@lists.netfilter.org,
	linux-kernel@vger.kernel.org
Subject: Re: [BK PATCH] Fix ip_conntrack_amanda data corruption bug that breaks amanda dumps
Date: Thu, 04 Nov 2004 22:53:11 +0100	[thread overview]
Message-ID: <418AA4C7.2030909@trash.net> (raw)
In-Reply-To: <20041104130028.099fc130.davem@davemloft.net>

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

David S. Miller wrote:

>You're right... the bug was introduced by my skb_header_pointer() changes.
>Look at this:
>
>	amp = skb_header_pointer(skb, dataoff,
>				 skb->len - dataoff, amanda_buffer);
>	BUG_ON(amp == NULL);
>	data = amp;
>	data_limit = amp + skb->len - dataoff;
>	*data_limit = '\0';
>
>It should just use the amanda_buffer always.
>
Thanks Dave and Herbert, here is the patch in case you haven't fixed it
already.

Regards
Patrick


[-- Attachment #2: x --]
[-- Type: text/plain, Size: 1813 bytes --]

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
#   2004/11/04 22:50:11+01:00 kaber@coreworks.de 
#   [NETFILTER]: Don't use skb_header_pointer in amanda conntrack helper
#   
#   Fixes broken packets, noticed by Matthias Andree <matthias.andree@gmx.de>
#   
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
# 
# net/ipv4/netfilter/ip_conntrack_amanda.c
#   2004/11/04 22:50:04+01:00 kaber@coreworks.de +5 -7
#   [NETFILTER]: Don't use skb_header_pointer in amanda conntrack helper
#   
#   Fixes broken packets, noticed by Matthias Andree <matthias.andree@gmx.de>
#   
#   Signed-off-by: Patrick McHardy <kaber@trash.net>
# 
diff -Nru a/net/ipv4/netfilter/ip_conntrack_amanda.c b/net/ipv4/netfilter/ip_conntrack_amanda.c
--- a/net/ipv4/netfilter/ip_conntrack_amanda.c	2004-11-04 22:50:37 +01:00
+++ b/net/ipv4/netfilter/ip_conntrack_amanda.c	2004-11-04 22:50:37 +01:00
@@ -49,7 +49,7 @@
 {
 	struct ip_conntrack_expect *exp;
 	struct ip_ct_amanda_expect *exp_amanda_info;
-	char *amp, *data, *data_limit, *tmp;
+	char *data, *data_limit, *tmp;
 	unsigned int dataoff, i;
 	u_int16_t port, len;
 
@@ -70,11 +70,9 @@
 	}
 
 	LOCK_BH(&amanda_buffer_lock);
-	amp = skb_header_pointer(skb, dataoff,
-				 skb->len - dataoff, amanda_buffer);
-	BUG_ON(amp == NULL);
-	data = amp;
-	data_limit = amp + skb->len - dataoff;
+	skb_copy_bits(skb, dataoff, amanda_buffer, skb->len - dataoff);
+	data = amanda_buffer;
+	data_limit = amanda_buffer + skb->len - dataoff;
 	*data_limit = '\0';
 
 	/* Search for the CONNECT string */
@@ -110,7 +108,7 @@
 		exp->mask.dst.u.tcp.port = 0xFFFF;
 
 		exp_amanda_info = &exp->help.exp_amanda_info;
-		exp_amanda_info->offset = tmp - amp;
+		exp_amanda_info->offset = tmp - amanda_buffer;
 		exp_amanda_info->port   = port;
 		exp_amanda_info->len    = len;
 

  reply	other threads:[~2004-11-04 21:53 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-04 12:15 [BK PATCH] Fix ip_conntrack_amanda data corruption bug that breaks amanda dumps Matthias Andree
2004-11-04 18:55 ` Patrick McHardy
2004-11-04 18:55   ` Patrick McHardy
2004-11-04 20:45   ` Herbert Xu
2004-11-04 20:45     ` Herbert Xu
2004-11-04 21:00     ` David S. Miller
2004-11-04 21:00       ` David S. Miller
2004-11-04 21:53       ` Patrick McHardy [this message]
2004-11-04 21:53         ` Patrick McHardy
2004-11-04 23:50         ` Matthias Andree
2004-11-04 23:50           ` Matthias Andree
2004-11-04 23:59           ` Patrick McHardy
2004-11-04 23:59             ` Patrick McHardy
2004-11-04 23:17   ` Matthias Andree
2004-11-04 23:17     ` Matthias Andree
2004-11-04 23:53     ` Patrick McHardy
2004-11-04 23:53       ` Patrick McHardy
2004-11-05  0:06       ` David S. Miller
2004-11-05  0:06         ` David S. Miller
2004-11-05  0:40         ` Patrick McHardy
2004-11-05  0:40           ` Patrick McHardy
2004-11-05  1:04         ` Matthias Andree
2004-11-05  1:04           ` Matthias Andree
2004-11-05  0:58           ` David S. Miller
2004-11-05  0:58             ` David S. Miller
2004-11-05 11:30             ` Matthias Andree
2004-11-05 11:30               ` Matthias Andree
2004-11-05 20:23       ` Pablo Neira
2004-11-05 22:19         ` Patrick McHardy
2004-11-05 22:19           ` Patrick McHardy
2004-11-06  1:53           ` Pablo Neira
2004-11-06  1:53             ` Pablo Neira
2004-11-07 12:16           ` Matthias Andree
2004-11-07 16:39             ` Patrick McHardy
2004-11-05 22:24         ` Henrik Nordstrom
2004-11-05 22:24           ` Henrik Nordstrom

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=418AA4C7.2030909@trash.net \
    --to=kaber@trash.net \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-net@vger.kernel.org \
    --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.