summaryrefslogtreecommitdiffstats
path: root/patches/cve/CVE-2018-10938-Cipso-cipso_v4_optptr-enter-infinite-loop.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/cve/CVE-2018-10938-Cipso-cipso_v4_optptr-enter-infinite-loop.patch')
-rw-r--r--patches/cve/CVE-2018-10938-Cipso-cipso_v4_optptr-enter-infinite-loop.patch47
1 files changed, 47 insertions, 0 deletions
diff --git a/patches/cve/CVE-2018-10938-Cipso-cipso_v4_optptr-enter-infinite-loop.patch b/patches/cve/CVE-2018-10938-Cipso-cipso_v4_optptr-enter-infinite-loop.patch
new file mode 100644
index 0000000..68a5d28
--- /dev/null
+++ b/patches/cve/CVE-2018-10938-Cipso-cipso_v4_optptr-enter-infinite-loop.patch
@@ -0,0 +1,47 @@
1From 40413955ee265a5e42f710940ec78f5450d49149 Mon Sep 17 00:00:00 2001
2From: "yujuan.qi" <yujuan.qi@mediatek.com>
3Date: Mon, 31 Jul 2017 11:23:01 +0800
4Subject: [PATCH] Cipso: cipso_v4_optptr enter infinite loop
5
6in for(),if((optlen > 0) && (optptr[1] == 0)), enter infinite loop.
7
8Test: receive a packet which the ip length > 20 and the first byte of ip option is 0, produce this issue
9
10CVE: CVE-2018-10938
11Upstream-Status: Backport
12
13Signed-off-by: yujuan.qi <yujuan.qi@mediatek.com>
14Acked-by: Paul Moore <paul@paul-moore.com>
15Signed-off-by: David S. Miller <davem@davemloft.net>
16Signed-off-by: Andreas Wellving <andreas.wellving@enea.com>
17---
18 net/ipv4/cipso_ipv4.c | 12 ++++++++++--
19 1 file changed, 10 insertions(+), 2 deletions(-)
20
21diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c
22index c4c6e19..2ae8f54 100644
23--- a/net/ipv4/cipso_ipv4.c
24+++ b/net/ipv4/cipso_ipv4.c
25@@ -1523,9 +1523,17 @@ unsigned char *cipso_v4_optptr(const struct sk_buff *skb)
26 int taglen;
27
28 for (optlen = iph->ihl*4 - sizeof(struct iphdr); optlen > 0; ) {
29- if (optptr[0] == IPOPT_CIPSO)
30+ switch (optptr[0]) {
31+ case IPOPT_CIPSO:
32 return optptr;
33- taglen = optptr[1];
34+ case IPOPT_END:
35+ return NULL;
36+ case IPOPT_NOOP:
37+ taglen = 1;
38+ break;
39+ default:
40+ taglen = optptr[1];
41+ }
42 optlen -= taglen;
43 optptr += taglen;
44 }
45--
462.7.4
47