Skip to contentSkip to conversation

: ipv6_skip_exthdr() may refer invalid memory area

PATCH Applied Yasuyuki Kozakai 2 participants 4 messages Feb 20, 2004 – Feb 26, 2004

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : ipv6_skip_exthdr() may refer invalid memory area

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 <[email protected]>

net/ipv6/exthdrs.c +10 -2
diff -Nur linux-2.6.3/net/ipv6/exthdrs.c linux-2.6.3-fixed/net/ipv6/exthdrs.c
@@ -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)
#1 lore raw
Quoted 4 lines · On Fri, 20 Feb 2004 14:33:59 +0900 (JST) Yasuyuki Kozakai…

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

please apply this patch.

Applied, thank you Yasuyuki-san.

#2 lore raw

Hi,

This patch is for linux 2.4.26-pre1 .

-----------------------------------------------------------------
Yasuyuki KOZAKAI @ USAGI Project <[email protected]>

From: "David S. Miller" <[email protected]>
Date: Fri, 20 Feb 2004 09:30:27 -0800

Quoted 9 lines
Quoted 4 lines · On Fri, 20 Feb 2004 14:33:59 +0900 (JST) Yasuyuki Kozakai…

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

please apply this patch.

Applied, thank you Yasuyuki-san.

net/ipv6/exthdrs.c +10 -2
diff -Nur linux-2.4.26-pre1/net/ipv6/exthdrs.c linux-2.4.26-pre1-fixed/net/ipv6/exthdrs.c
@@ -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)
#3 lore raw
Quoted 1 line · On Thu, 26 Feb 2004 12:48:31 +0900 (JST) Yasuyuki Kozakai…

This patch is for linux 2.4.26-pre1 .

Applied, thank you.