Home Home > GIT Browse > SLE12-SP5-AZURE
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiroslav Benes <mbenes@suse.cz>2019-09-04 16:36:33 +0200
committerMiroslav Benes <mbenes@suse.cz>2019-09-05 13:09:58 +0200
commit51371b7091eed11d771c7ae2da7018fe49bf8e3d (patch)
tree9ccd787e46353db1ddbcb348b06dab66a04ec2b4
parentb0a7e900346397a74c6cf82097edcb0c5ca794f0 (diff)
ftrace: Check for successful allocation of hash (bsc#1149424).
-rw-r--r--patches.suse/ftrace-check-for-successful-allocation-of-hash.patch40
-rw-r--r--series.conf1
2 files changed, 41 insertions, 0 deletions
diff --git a/patches.suse/ftrace-check-for-successful-allocation-of-hash.patch b/patches.suse/ftrace-check-for-successful-allocation-of-hash.patch
new file mode 100644
index 0000000000..35572e2cfe
--- /dev/null
+++ b/patches.suse/ftrace-check-for-successful-allocation-of-hash.patch
@@ -0,0 +1,40 @@
+From: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
+Date: Thu, 4 Jul 2019 20:04:42 +0530
+Subject: ftrace: Check for successful allocation of hash
+Git-commit: 5b0022dd32b7c2e15edf1827ba80aa1407edf9ff
+Patch-mainline: v5.3-rc7
+References: bsc#1149424
+
+In register_ftrace_function_probe(), we are not checking the return
+value of alloc_and_copy_ftrace_hash(). The subsequent call to
+ftrace_match_records() may end up dereferencing the same. Add a check to
+ensure this doesn't happen.
+
+Link: http://lkml.kernel.org/r/26e92574f25ad23e7cafa3cf5f7a819de1832cbe.1562249521.git.naveen.n.rao@linux.vnet.ibm.com
+
+Cc: stable@vger.kernel.org
+Fixes: 1ec3a81a0cf42 ("ftrace: Have each function probe use its own ftrace_ops")
+Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
+Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
+Acked-by: Miroslav Benes <mbenes@suse.cz>
+---
+ kernel/trace/ftrace.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
+index 6200a6fe10e3..f9821a3374e9 100644
+--- a/kernel/trace/ftrace.c
++++ b/kernel/trace/ftrace.c
+@@ -4338,6 +4338,11 @@ register_ftrace_function_probe(char *glob, struct trace_array *tr,
+ old_hash = *orig_hash;
+ hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS, old_hash);
+
++ if (!hash) {
++ ret = -ENOMEM;
++ goto out;
++ }
++
+ ret = ftrace_match_records(hash, glob, strlen(glob));
+
+ /* Nothing found? */
+
diff --git a/series.conf b/series.conf
index 0c208975aa..cbb01fdf9e 100644
--- a/series.conf
+++ b/series.conf
@@ -24159,6 +24159,7 @@
patches.suse/kvm-x86-don-t-update-rip-or-do-single-step-on-faulting-emulation
patches.suse/ftrace-fix-null-pointer-dereference-in-t_probe_next.patch
patches.suse/ftrace-check-for-empty-hash-and-comment-the-race-with-registering-probes.patch
+ patches.suse/ftrace-check-for-successful-allocation-of-hash.patch
patches.suse/batman-adv-Only-read-OGM-tvlv_len-after-buffer-len-c.patch
patches.suse/batman-adv-Only-read-OGM2-tvlv_len-after-buffer-len-.patch
patches.suse/usb-host-xhci-rcar-Fix-typo-in-compatible-string-mat.patch