summaryrefslogtreecommitdiff
path: root/sys-kernel/cairn-sources/files/5.9.6/hardened-patches/0052-bug-on-kmem_cache_free-with-the-wrong-cache.patch
diff options
context:
space:
mode:
Diffstat (limited to 'sys-kernel/cairn-sources/files/5.9.6/hardened-patches/0052-bug-on-kmem_cache_free-with-the-wrong-cache.patch')
-rw-r--r--sys-kernel/cairn-sources/files/5.9.6/hardened-patches/0052-bug-on-kmem_cache_free-with-the-wrong-cache.patch40
1 files changed, 40 insertions, 0 deletions
diff --git a/sys-kernel/cairn-sources/files/5.9.6/hardened-patches/0052-bug-on-kmem_cache_free-with-the-wrong-cache.patch b/sys-kernel/cairn-sources/files/5.9.6/hardened-patches/0052-bug-on-kmem_cache_free-with-the-wrong-cache.patch
new file mode 100644
index 000000000000..d11d75623de4
--- /dev/null
+++ b/sys-kernel/cairn-sources/files/5.9.6/hardened-patches/0052-bug-on-kmem_cache_free-with-the-wrong-cache.patch
@@ -0,0 +1,40 @@
+From 79ee25c0ea90a90dec03a36d11140f234ab8f3cc Mon Sep 17 00:00:00 2001
+From: Daniel Micay <danielmicay@gmail.com>
+Date: Wed, 3 May 2017 11:50:53 -0400
+Subject: [PATCH 052/108] bug on kmem_cache_free with the wrong cache
+
+At least when CONFIG_BUG_ON_DATA_CORRUPTION is enabled.
+
+Signed-off-by: Daniel Micay <danielmicay@gmail.com>
+Signed-off-by: Thibaut Sautereau <thibaut.sautereau@ssi.gouv.fr>
+Signed-off-by: Levente Polyak <levente@leventepolyak.net>
+---
+ mm/slab.h | 11 ++++++++---
+ 1 file changed, 8 insertions(+), 3 deletions(-)
+
+diff --git a/mm/slab.h b/mm/slab.h
+index 3016434f640e..1567964fdaaa 100644
+--- a/mm/slab.h
++++ b/mm/slab.h
+@@ -465,10 +465,15 @@ static inline struct kmem_cache *cache_from_obj(struct kmem_cache *s, void *x)
+ return s;
+
+ cachep = virt_to_cache(x);
+- if (WARN(cachep && cachep != s,
+- "%s: Wrong slab cache. %s but object is from %s\n",
+- __func__, s->name, cachep->name))
++ if (cachep && cachep != s) {
++#ifdef CONFIG_BUG_ON_DATA_CORRUPTION
++ BUG();
++#else
++ WARN(1, "%s: Wrong slab cache. %s but object is from %s\n",
++ __func__, s->name, cachep->name);
+ print_tracking(cachep, x);
++#endif
++ }
+ return cachep;
+ }
+
+--
+2.29.2
+