aboutsummaryrefslogtreecommitdiffstats
path: root/arch/i386/kernel/kprobes.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/i386/kernel/kprobes.c')
-rw-r--r--arch/i386/kernel/kprobes.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/arch/i386/kernel/kprobes.c b/arch/i386/kernel/kprobes.c
index 7a97544f15a0..d98e44b16fe2 100644
--- a/arch/i386/kernel/kprobes.c
+++ b/arch/i386/kernel/kprobes.c
@@ -396,11 +396,12 @@ no_kprobe:
396fastcall void *__kprobes trampoline_handler(struct pt_regs *regs) 396fastcall void *__kprobes trampoline_handler(struct pt_regs *regs)
397{ 397{
398 struct kretprobe_instance *ri = NULL; 398 struct kretprobe_instance *ri = NULL;
399 struct hlist_head *head; 399 struct hlist_head *head, empty_rp;
400 struct hlist_node *node, *tmp; 400 struct hlist_node *node, *tmp;
401 unsigned long flags, orig_ret_address = 0; 401 unsigned long flags, orig_ret_address = 0;
402 unsigned long trampoline_address =(unsigned long)&kretprobe_trampoline; 402 unsigned long trampoline_address =(unsigned long)&kretprobe_trampoline;
403 403
404 INIT_HLIST_HEAD(&empty_rp);
404 spin_lock_irqsave(&kretprobe_lock, flags); 405 spin_lock_irqsave(&kretprobe_lock, flags);
405 head = kretprobe_inst_table_head(current); 406 head = kretprobe_inst_table_head(current);
406 407
@@ -429,7 +430,7 @@ fastcall void *__kprobes trampoline_handler(struct pt_regs *regs)
429 } 430 }
430 431
431 orig_ret_address = (unsigned long)ri->ret_addr; 432 orig_ret_address = (unsigned long)ri->ret_addr;
432 recycle_rp_inst(ri); 433 recycle_rp_inst(ri, &empty_rp);
433 434
434 if (orig_ret_address != trampoline_address) 435 if (orig_ret_address != trampoline_address)
435 /* 436 /*
@@ -444,6 +445,10 @@ fastcall void *__kprobes trampoline_handler(struct pt_regs *regs)
444 445
445 spin_unlock_irqrestore(&kretprobe_lock, flags); 446 spin_unlock_irqrestore(&kretprobe_lock, flags);
446 447
448 hlist_for_each_entry_safe(ri, node, tmp, &empty_rp, hlist) {
449 hlist_del(&ri->hlist);
450 kfree(ri);
451 }
447 return (void*)orig_ret_address; 452 return (void*)orig_ret_address;
448} 453}
449 454