summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.2/0123-kprobes-initialize-before-using-a-hlist.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.2/0123-kprobes-initialize-before-using-a-hlist.patch')
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.2/0123-kprobes-initialize-before-using-a-hlist.patch49
1 files changed, 49 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.2/0123-kprobes-initialize-before-using-a-hlist.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.2/0123-kprobes-initialize-before-using-a-hlist.patch
new file mode 100644
index 00000000..9311e08d
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.2/0123-kprobes-initialize-before-using-a-hlist.patch
@@ -0,0 +1,49 @@
1From 4dbd29bd7e0b2a712370f8d0c25d025d996edbc1 Mon Sep 17 00:00:00 2001
2From: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
3Date: Fri, 20 Jan 2012 14:34:04 -0800
4Subject: [PATCH 123/130] kprobes: initialize before using a hlist
5
6commit d496aab567e7e52b3e974c9192a5de6e77dce32c upstream.
7
8Commit ef53d9c5e ("kprobes: improve kretprobe scalability with hashed
9locking") introduced a bug where we can potentially leak
10kretprobe_instances since we initialize a hlist head after having used
11it.
12
13Initialize the hlist head before using it.
14
15Reported by: Jim Keniston <jkenisto@us.ibm.com>
16Acked-by: Jim Keniston <jkenisto@us.ibm.com>
17Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
18Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
19Cc: Srinivasa D S <srinivasa@in.ibm.com>
20Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
21Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
22Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
23---
24 kernel/kprobes.c | 2 +-
25 1 files changed, 1 insertions(+), 1 deletions(-)
26
27diff --git a/kernel/kprobes.c b/kernel/kprobes.c
28index e5d8464..52fd049 100644
29--- a/kernel/kprobes.c
30+++ b/kernel/kprobes.c
31@@ -1077,6 +1077,7 @@ void __kprobes kprobe_flush_task(struct task_struct *tk)
32 /* Early boot. kretprobe_table_locks not yet initialized. */
33 return;
34
35+ INIT_HLIST_HEAD(&empty_rp);
36 hash = hash_ptr(tk, KPROBE_HASH_BITS);
37 head = &kretprobe_inst_table[hash];
38 kretprobe_table_lock(hash, &flags);
39@@ -1085,7 +1086,6 @@ void __kprobes kprobe_flush_task(struct task_struct *tk)
40 recycle_rp_inst(ri, &empty_rp);
41 }
42 kretprobe_table_unlock(hash, &flags);
43- INIT_HLIST_HEAD(&empty_rp);
44 hlist_for_each_entry_safe(ri, node, tmp, &empty_rp, hlist) {
45 hlist_del(&ri->hlist);
46 kfree(ri);
47--
481.7.7.4
49