From 2667ddc2717adbe7297c6a5cc74266804bc17bbe Mon Sep 17 00:00:00 2001 From: Vyacheslav Cherkashin Date: Mon, 7 Apr 2014 14:27:42 +0400 Subject: [PATCH] [FIX] add uretprobe null check (ri->rp) in trampoline_uprobe_handler() Change-Id: I5d6d7935f369349f06bcc864bd82f15ca862d217 Signed-off-by: Vyacheslav Cherkashin --- uprobe/swap_uprobes.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/uprobe/swap_uprobes.c b/uprobe/swap_uprobes.c index 393811f..3792476 100644 --- a/uprobe/swap_uprobes.c +++ b/uprobe/swap_uprobes.c @@ -619,6 +619,7 @@ void dbi_unregister_ujprobe(struct ujprobe *jp) int trampoline_uprobe_handler(struct kprobe *p, struct pt_regs *regs) { struct uretprobe_instance *ri = NULL; + struct kprobe *kp; struct hlist_head *head; unsigned long flags, tramp_addr, orig_ret_addr = 0; struct hlist_node *tmp; @@ -648,14 +649,18 @@ int trampoline_uprobe_handler(struct kprobe *p, struct pt_regs *regs) continue; } - if (ri->rp && ri->rp->handler) { - ri->rp->handler(ri, regs); + kp = NULL; + if (ri->rp) { + kp = up2kp(&ri->rp->up); + + if (ri->rp->handler) + ri->rp->handler(ri, regs); } orig_ret_addr = (unsigned long)ri->ret_addr; recycle_urp_inst(ri); - if (orig_ret_addr != tramp_addr && &ri->rp->up.kp == p) { + if ((orig_ret_addr != tramp_addr && kp == p) || kp == NULL) { /* * This is the real return address. Any other * instances associated with this task are for -- 2.7.4