[linux] 01/01: ipv6: Check ip6_find_1stfragopt() return value properly.

debian-kernel at lists.debian.org debian-kernel at lists.debian.org
Thu Jun 1 14:27:28 UTC 2017


This is an automated email from the git hooks/post-receive script.

benh pushed a commit to branch jessie-security
in repository linux.

commit 5bfcb79411997eac2479fd5002fdf03a2f928303
Author: Ben Hutchings <ben at decadent.org.uk>
Date:   Thu Jun 1 15:27:01 2017 +0100

    ipv6: Check ip6_find_1stfragopt() return value properly.
    
    Needed after fix for CVE-2017-9074.
---
 debian/changelog                                   |  1 +
 ...ip6_find_1stfragopt-return-value-properly.patch | 85 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 3 files changed, 87 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 9f924d5..5da0d83 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -12,6 +12,7 @@ linux (3.16.43-2+deb8u1) UNRELEASED; urgency=medium
     (CVE-2017-8924)
   * USB: serial: omninet: fix reference leaks at open (CVE-2017-8925)
   * ipv6: Prevent overrun when parsing v6 header options (CVE-2017-9074)
+  * ipv6: Check ip6_find_1stfragopt() return value properly.
   * sctp: do not inherit ipv6_{mc|ac|fl}_list from parent (CVE-2017-9075)
   * ipv6/dccp: do not inherit ipv6_mc_list from parent (CVE-2017-9076,
     CVE-2017-9077)
diff --git a/debian/patches/bugfix/all/ipv6-check-ip6_find_1stfragopt-return-value-properly.patch b/debian/patches/bugfix/all/ipv6-check-ip6_find_1stfragopt-return-value-properly.patch
new file mode 100644
index 0000000..671561e
--- /dev/null
+++ b/debian/patches/bugfix/all/ipv6-check-ip6_find_1stfragopt-return-value-properly.patch
@@ -0,0 +1,85 @@
+From: "David S. Miller" <davem at davemloft.net>
+Date: Wed, 17 May 2017 22:54:11 -0400
+Subject: ipv6: Check ip6_find_1stfragopt() return value properly.
+Origin: https://git.kernel.org/linus/7dd7eb9513bd02184d45f000ab69d78cb1fa1531
+Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2017-9075
+
+Do not use unsigned variables to see if it returns a negative
+error or not.
+
+Fixes: 2423496af35d ("ipv6: Prevent overrun when parsing v6 header options")
+Reported-by: Julia Lawall <julia.lawall at lip6.fr>
+Signed-off-by: David S. Miller <davem at davemloft.net>
+[bwh: Backported to 3.16: adjust context]
+---
+ net/ipv6/ip6_offload.c | 9 ++++-----
+ net/ipv6/ip6_output.c  | 7 +++----
+ net/ipv6/udp_offload.c | 8 +++++---
+ 3 files changed, 12 insertions(+), 12 deletions(-)
+
+--- a/net/ipv6/ip6_offload.c
++++ b/net/ipv6/ip6_offload.c
+@@ -86,7 +86,6 @@ static struct sk_buff *ipv6_gso_segment(
+ 	const struct net_offload *ops;
+ 	int proto;
+ 	struct frag_hdr *fptr;
+-	unsigned int unfrag_ip6hlen;
+ 	u8 *prevhdr;
+ 	int offset = 0;
+ 	bool encap, udpfrag;
+@@ -144,10 +143,10 @@ static struct sk_buff *ipv6_gso_segment(
+ 		skb->network_header = (u8 *)ipv6h - skb->head;
+ 
+ 		if (udpfrag) {
+-			unfrag_ip6hlen = ip6_find_1stfragopt(skb, &prevhdr);
+-			if (unfrag_ip6hlen < 0)
+-				return ERR_PTR(unfrag_ip6hlen);
+-			fptr = (struct frag_hdr *)((u8 *)ipv6h + unfrag_ip6hlen);
++			int err = ip6_find_1stfragopt(skb, &prevhdr);
++			if (err < 0)
++				return ERR_PTR(err);
++			fptr = (struct frag_hdr *)((u8 *)ipv6h + err);
+ 			fptr->frag_off = htons(offset);
+ 			if (skb->next != NULL)
+ 				fptr->frag_off |= htons(IP6_MF);
+--- a/net/ipv6/ip6_output.c
++++ b/net/ipv6/ip6_output.c
+@@ -566,11 +566,10 @@ int ip6_fragment(struct sk_buff *skb, in
+ 	u8 *prevhdr, nexthdr = 0;
+ 	struct net *net = dev_net(skb_dst(skb)->dev);
+ 
+-	hlen = ip6_find_1stfragopt(skb, &prevhdr);
+-	if (hlen < 0) {
+-		err = hlen;
++	err = ip6_find_1stfragopt(skb, &prevhdr);
++	if (err < 0)
+ 		goto fail;
+-	}
++	hlen = err;
+ 	nexthdr = *prevhdr;
+ 
+ 	mtu = ip6_skb_dst_mtu(skb);
+--- a/net/ipv6/udp_offload.c
++++ b/net/ipv6/udp_offload.c
+@@ -51,6 +51,7 @@ static struct sk_buff *udp6_ufo_fragment
+ 	int offset;
+ 	__wsum csum;
+ 	int tnl_hlen;
++	int err;
+ 
+ 	mss = skb_shinfo(skb)->gso_size;
+ 	if (unlikely(skb->len <= mss))
+@@ -101,9 +102,10 @@ static struct sk_buff *udp6_ufo_fragment
+ 		/* Find the unfragmentable header and shift it left by frag_hdr_sz
+ 		 * bytes to insert fragment header.
+ 		 */
+-		unfrag_ip6hlen = ip6_find_1stfragopt(skb, &prevhdr);
+-		if (unfrag_ip6hlen < 0)
+-			return ERR_PTR(unfrag_ip6hlen);
++		err = ip6_find_1stfragopt(skb, &prevhdr);
++		if (err < 0)
++			return ERR_PTR(err);
++		unfrag_ip6hlen = err;
+ 		nexthdr = *prevhdr;
+ 		*prevhdr = NEXTHDR_FRAGMENT;
+ 		unfrag_len = (skb_network_header(skb) - skb_mac_header(skb)) +
diff --git a/debian/patches/series b/debian/patches/series
index 5e4f52f..4cd00cd 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -704,6 +704,7 @@ bugfix/all/dccp-tcp-do-not-inherit-mc_list-from-parent.patch
 bugfix/all/usb-serial-io_ti-fix-information-leak-in-completion-.patch
 bugfix/all/usb-serial-omninet-fix-reference-leaks-at-open.patch
 bugfix/all/ipv6-prevent-overrun-when-parsing-v6-header-options.patch
+bugfix/all/ipv6-check-ip6_find_1stfragopt-return-value-properly.patch
 bugfix/all/sctp-do-not-inherit-ipv6_-mc-ac-fl-_list-from-parent.patch
 bugfix/all/ipv6-dccp-do-not-inherit-ipv6_mc_list-from-parent.patch
 bugfix/all/ipv6-fix-out-of-bound-writes-in-__ip6_append_data.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/linux.git



More information about the Kernel-svn-changes mailing list