Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiroslav Benes <mbenes@suse.cz>2018-09-12 17:10:04 +0200
committerMiroslav Benes <mbenes@suse.cz>2018-09-12 17:10:04 +0200
commita8e3a98526e2cd5e6c7edbe28c8e3cbf1d92d2e2 (patch)
treee5f1d969fd0971cc1364bcd842ebe5e8bb6a4753
parent3b16b69221a5664245f901e1ef557eb1990a66de (diff)
parent018b0ab718a056d068085f7e36a7595b664f7145 (diff)
Merge branch 'bsc#1106191_12' into SLE12-SP3_Update_2
-rw-r--r--bsc1106191/kgr_patch_bsc1106191.c73
-rw-r--r--bsc1106191/kgr_patch_bsc1106191.h16
2 files changed, 89 insertions, 0 deletions
diff --git a/bsc1106191/kgr_patch_bsc1106191.c b/bsc1106191/kgr_patch_bsc1106191.c
new file mode 100644
index 0000000..afa022d
--- /dev/null
+++ b/bsc1106191/kgr_patch_bsc1106191.c
@@ -0,0 +1,73 @@
+/*
+ * kgraft_patch_bsc1106191
+ *
+ * Fix for CVE-2018-10938, bsc#1106191
+ *
+ * Upstream commit:
+ * 40413955ee26 ("Cipso: cipso_v4_optptr enter infinite loop")
+ *
+ * SLE12(-SP1) commit:
+ * not affected
+ *
+ * SLE12-SP2 and -SP3 commit:
+ * dfcceea9d5f7cb02078e0e0176279d50a061eb35
+ *
+ * SLE15 commit:
+ * 4af59ddef75512b3e8bcaa0cb3bc06b56001cb50
+ *
+ *
+ * Copyright (c) 2018 SUSE
+ * Author: Nicolai Stange <nstange@suse.de>
+ *
+ * Based on the original Linux kernel code. Other copyrights apply.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/skbuff.h>
+#include <linux/ip.h>
+#include "kgr_patch_bsc1106191.h"
+
+/* patched */
+unsigned char *kgr_cipso_v4_optptr(const struct sk_buff *skb)
+{
+ const struct iphdr *iph = ip_hdr(skb);
+ unsigned char *optptr = (unsigned char *)&(ip_hdr(skb)[1]);
+ int optlen;
+ int taglen;
+
+ for (optlen = iph->ihl*4 - sizeof(struct iphdr); optlen > 0; ) {
+ /*
+ * Fix CVE-2018-10938
+ * -3 lines, +11 lines
+ */
+ switch (optptr[0]) {
+ case IPOPT_CIPSO:
+ return optptr;
+ case IPOPT_END:
+ return NULL;
+ case IPOPT_NOOP:
+ taglen = 1;
+ break;
+ default:
+ taglen = optptr[1];
+ }
+ optlen -= taglen;
+ optptr += taglen;
+ }
+
+ return NULL;
+}
diff --git a/bsc1106191/kgr_patch_bsc1106191.h b/bsc1106191/kgr_patch_bsc1106191.h
new file mode 100644
index 0000000..ba5fe18
--- /dev/null
+++ b/bsc1106191/kgr_patch_bsc1106191.h
@@ -0,0 +1,16 @@
+#ifndef _KGR_PATCH_BSC1106191_H
+#define _KGR_PATCH_BSC1106191_H
+
+static inline int kgr_patch_bsc1106191_init(void) { return 0; }
+
+static inline void kgr_patch_bsc1106191_cleanup(void) {}
+
+
+struct sk_buff;
+
+unsigned char *kgr_cipso_v4_optptr(const struct sk_buff *skb);
+
+#define KGR_PATCH_BSC1106191_FUNCS \
+ KGR_PATCH(cipso_v4_optptr, kgr_cipso_v4_optptr), \
+
+#endif /* _KGR_PATCH_BSC1106191_H */