From 00210ac1b365ae4a8d2067a6456d4f163a514ff9 Mon Sep 17 00:00:00 2001 From: Sona Sarmadi Date: Fri, 29 Sep 2017 12:28:02 +0200 Subject: linux-cavium: CVE-2017-5970 ipv4: Invalid IP options could cause skb->dst drop Reference: https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2017-5970 Signed-off-by: Sona Sarmadi Signed-off-by: Adrian Dudau --- .../linux/linux-cavium/CVE-2017-5970.patch | 54 ++++++++++++++++++++++ recipes-kernel/linux/linux-cavium_4.9.inc | 1 + 2 files changed, 55 insertions(+) create mode 100644 recipes-kernel/linux/linux-cavium/CVE-2017-5970.patch diff --git a/recipes-kernel/linux/linux-cavium/CVE-2017-5970.patch b/recipes-kernel/linux/linux-cavium/CVE-2017-5970.patch new file mode 100644 index 0000000..ddfcca1 --- /dev/null +++ b/recipes-kernel/linux/linux-cavium/CVE-2017-5970.patch @@ -0,0 +1,54 @@ +From f5b54446630a973e1f27b68599366bbd0ac53066 Mon Sep 17 00:00:00 2001 +From: Eric Dumazet +Date: Sat, 4 Feb 2017 11:16:52 -0800 +Subject: [PATCH] ipv4: keep skb->dst around in presence of IP options + +[ Upstream commit 34b2cef20f19c87999fff3da4071e66937db9644 ] + +Andrey Konovalov got crashes in __ip_options_echo() when a NULL skb->dst +is accessed. + +ipv4_pktinfo_prepare() should not drop the dst if (evil) IP options +are present. + +We could refine the test to the presence of ts_needtime or srr, +but IP options are not often used, so let's be conservative. + +Thanks to syzkaller team for finding this bug. + +CVE: CVE-2017-5970 +Upstream-Status: Backport [from kernel.org longterm 4.9.52] + +Fixes: d826eb14ecef ("ipv4: PKTINFO doesnt need dst reference") +Signed-off-by: Eric Dumazet +Reported-by: Andrey Konovalov +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sona Sarmadi +--- + net/ipv4/ip_sockglue.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c +index f226f408..65336f3 100644 +--- a/net/ipv4/ip_sockglue.c ++++ b/net/ipv4/ip_sockglue.c +@@ -1215,7 +1215,14 @@ void ipv4_pktinfo_prepare(const struct sock *sk, struct sk_buff *skb) + pktinfo->ipi_ifindex = 0; + pktinfo->ipi_spec_dst.s_addr = 0; + } +- skb_dst_drop(skb); ++ /* We need to keep the dst for __ip_options_echo() ++ * We could restrict the test to opt.ts_needtime || opt.srr, ++ * but the following is good enough as IP options are not often used. ++ */ ++ if (unlikely(IPCB(skb)->opt.optlen)) ++ skb_dst_force(skb); ++ else ++ skb_dst_drop(skb); + } + + int ip_setsockopt(struct sock *sk, int level, +-- +1.9.1 + diff --git a/recipes-kernel/linux/linux-cavium_4.9.inc b/recipes-kernel/linux/linux-cavium_4.9.inc index e35c12f..fc1a341 100644 --- a/recipes-kernel/linux/linux-cavium_4.9.inc +++ b/recipes-kernel/linux/linux-cavium_4.9.inc @@ -20,6 +20,7 @@ SRC_URI = "git://git@git.enea.com/linux/linux-cavium.git;protocol=ssh;name=machi file://CVE-2017-5551.patch \ file://CVE-2017-5577.patch \ file://CVE-2017-5669.patch \ + file://CVE-2017-5970.patch \ file://CVE-2017-7487.patch \ file://CVE-2017-7618.patch \ file://CVE-2017-7645.patch \ -- cgit v1.2.3-54-g00ecf