diff options
Diffstat (limited to 'arch/powerpc/kernel')
-rw-r--r-- | arch/powerpc/kernel/kprobes.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c index 46d2fd0e5789..7b8d12b9026c 100644 --- a/arch/powerpc/kernel/kprobes.c +++ b/arch/powerpc/kernel/kprobes.c | |||
@@ -260,11 +260,12 @@ void kretprobe_trampoline_holder(void) | |||
260 | int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) | 260 | int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) |
261 | { | 261 | { |
262 | struct kretprobe_instance *ri = NULL; | 262 | struct kretprobe_instance *ri = NULL; |
263 | struct hlist_head *head; | 263 | struct hlist_head *head, empty_rp; |
264 | struct hlist_node *node, *tmp; | 264 | struct hlist_node *node, *tmp; |
265 | unsigned long flags, orig_ret_address = 0; | 265 | unsigned long flags, orig_ret_address = 0; |
266 | unsigned long trampoline_address =(unsigned long)&kretprobe_trampoline; | 266 | unsigned long trampoline_address =(unsigned long)&kretprobe_trampoline; |
267 | 267 | ||
268 | INIT_HLIST_HEAD(&empty_rp); | ||
268 | spin_lock_irqsave(&kretprobe_lock, flags); | 269 | spin_lock_irqsave(&kretprobe_lock, flags); |
269 | head = kretprobe_inst_table_head(current); | 270 | head = kretprobe_inst_table_head(current); |
270 | 271 | ||
@@ -290,7 +291,7 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) | |||
290 | ri->rp->handler(ri, regs); | 291 | ri->rp->handler(ri, regs); |
291 | 292 | ||
292 | orig_ret_address = (unsigned long)ri->ret_addr; | 293 | orig_ret_address = (unsigned long)ri->ret_addr; |
293 | recycle_rp_inst(ri); | 294 | recycle_rp_inst(ri, &empty_rp); |
294 | 295 | ||
295 | if (orig_ret_address != trampoline_address) | 296 | if (orig_ret_address != trampoline_address) |
296 | /* | 297 | /* |
@@ -308,6 +309,10 @@ int __kprobes trampoline_probe_handler(struct kprobe *p, struct pt_regs *regs) | |||
308 | spin_unlock_irqrestore(&kretprobe_lock, flags); | 309 | spin_unlock_irqrestore(&kretprobe_lock, flags); |
309 | preempt_enable_no_resched(); | 310 | preempt_enable_no_resched(); |
310 | 311 | ||
312 | hlist_for_each_entry_safe(ri, node, tmp, &empty_rp, hlist) { | ||
313 | hlist_del(&ri->hlist); | ||
314 | kfree(ri); | ||
315 | } | ||
311 | /* | 316 | /* |
312 | * By returning a non-zero value, we are telling | 317 | * By returning a non-zero value, we are telling |
313 | * kprobe_handler() that we don't want the post_handler | 318 | * kprobe_handler() that we don't want the post_handler |