netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH]: ipv6_skip_exthdr() may refer invalid memory area
@ 2004-02-20  5:33 Yasuyuki Kozakai
  2004-02-20 17:30 ` David S. Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Yasuyuki Kozakai @ 2004-02-20  5:33 UTC (permalink / raw)
  To: netdev; +Cc: netfilter-devel, usagi-core

[-- Attachment #1: Type: Text/Plain, Size: 274 bytes --]


Hello,

ipv6_skip_exthdr() refer invalid memory area in the case
that packet includes Fragment Header.

please apply this patch.

Regards,

-----------------------------------------------------------------
Yasuyuki KOZAKAI @ USAGI Project <yasuyuki.kozakai@toshiba.co.jp>


[-- Attachment #2: linux-2.6.3-skip-exthdr.patch --]
[-- Type: Text/Plain, Size: 728 bytes --]

diff -Nur linux-2.6.3/net/ipv6/exthdrs.c linux-2.6.3-fixed/net/ipv6/exthdrs.c
--- linux-2.6.3/net/ipv6/exthdrs.c	2004-02-18 12:57:13.000000000 +0900
+++ linux-2.6.3-fixed/net/ipv6/exthdrs.c	2004-02-19 18:04:59.000000000 +0900
@@ -709,8 +709,16 @@
 		if (skb_copy_bits(skb, start, &hdr, sizeof(hdr)))
 			BUG();
 		if (nexthdr == NEXTHDR_FRAGMENT) {
-			struct frag_hdr *fhdr = (struct frag_hdr *) &hdr;
-			if (ntohs(fhdr->frag_off) & ~0x7)
+			unsigned short frag_off;
+			if (skb_copy_bits(skb,
+					  start+offsetof(struct frag_hdr,
+							 frag_off),
+					  &frag_off,
+					  sizeof(frag_off))) {
+				return -1;
+			}
+
+			if (ntohs(frag_off) & ~0x7)
 				break;
 			hdrlen = 8;
 		} else if (nexthdr == NEXTHDR_AUTH)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH]: ipv6_skip_exthdr() may refer invalid memory area
  2004-02-20  5:33 [PATCH]: ipv6_skip_exthdr() may refer invalid memory area Yasuyuki Kozakai
@ 2004-02-20 17:30 ` David S. Miller
  2004-02-26  3:48   ` Yasuyuki Kozakai
  0 siblings, 1 reply; 4+ messages in thread
From: David S. Miller @ 2004-02-20 17:30 UTC (permalink / raw)
  To: Yasuyuki Kozakai; +Cc: netdev, netfilter-devel, usagi-core

On Fri, 20 Feb 2004 14:33:59 +0900 (JST)
Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp> wrote:

> ipv6_skip_exthdr() refer invalid memory area in the case
> that packet includes Fragment Header.
> 
> please apply this patch.

Applied, thank you Yasuyuki-san.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH]: ipv6_skip_exthdr() may refer invalid memory area
  2004-02-20 17:30 ` David S. Miller
@ 2004-02-26  3:48   ` Yasuyuki Kozakai
  2004-02-26 20:37     ` David S. Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Yasuyuki Kozakai @ 2004-02-26  3:48 UTC (permalink / raw)
  To: davem; +Cc: netdev, netfilter-devel, usagi-core

[-- Attachment #1: Type: Text/Plain, Size: 541 bytes --]


Hi,

This patch is for linux 2.4.26-pre1 .

-----------------------------------------------------------------
Yasuyuki KOZAKAI @ USAGI Project <yasuyuki.kozakai@toshiba.co.jp>


From: "David S. Miller" <davem@redhat.com>
Date: Fri, 20 Feb 2004 09:30:27 -0800

> On Fri, 20 Feb 2004 14:33:59 +0900 (JST)
> Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp> wrote:
> 
> > ipv6_skip_exthdr() refer invalid memory area in the case
> > that packet includes Fragment Header.
> > 
> > please apply this patch.
> 
> Applied, thank you Yasuyuki-san.

[-- Attachment #2: linux-2.4.26-pre1-skip-exthdr.patch --]
[-- Type: Text/Plain, Size: 752 bytes --]

diff -Nur linux-2.4.26-pre1/net/ipv6/exthdrs.c linux-2.4.26-pre1-fixed/net/ipv6/exthdrs.c
--- linux-2.4.26-pre1/net/ipv6/exthdrs.c	2003-08-25 20:44:44.000000000 +0900
+++ linux-2.4.26-pre1-fixed/net/ipv6/exthdrs.c	2004-02-26 10:44:21.000000000 +0900
@@ -798,8 +798,16 @@
 		if (skb_copy_bits(skb, start, &hdr, sizeof(hdr)))
 			BUG();
 		if (nexthdr == NEXTHDR_FRAGMENT) {
-			struct frag_hdr *fhdr = (struct frag_hdr *) &hdr;
-			if (ntohs(fhdr->frag_off) & ~0x7)
+			unsigned short frag_off;
+			if (skb_copy_bits(skb,
+					  start+offsetof(struct frag_hdr,
+							 frag_off),
+					  &frag_off,
+					  sizeof(frag_off))) {
+				return -1;
+			}
+
+			if (ntohs(frag_off) & ~0x7)
 				break;
 			hdrlen = 8;
 		} else if (nexthdr == NEXTHDR_AUTH)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH]: ipv6_skip_exthdr() may refer invalid memory area
  2004-02-26  3:48   ` Yasuyuki Kozakai
@ 2004-02-26 20:37     ` David S. Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David S. Miller @ 2004-02-26 20:37 UTC (permalink / raw)
  To: Yasuyuki Kozakai; +Cc: netdev, netfilter-devel, usagi-core

On Thu, 26 Feb 2004 12:48:31 +0900 (JST)
Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp> wrote:

> This patch is for linux 2.4.26-pre1 .

Applied, thank you.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-02-26 20:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-20  5:33 [PATCH]: ipv6_skip_exthdr() may refer invalid memory area Yasuyuki Kozakai
2004-02-20 17:30 ` David S. Miller
2004-02-26  3:48   ` Yasuyuki Kozakai
2004-02-26 20:37     ` David S. Miller

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).