From 699b1413f46c359f8b2c9cf8dd591d446881b65c Mon Sep 17 00:00:00 2001 From: Vasiliy Ulyanov Date: Wed, 4 Jun 2014 12:16:33 +0400 Subject: [PATCH] [IMPROVE] Add orig_ret_addr restore condition In some situations there is no need to restore the original return address because all the related actions are performed inside the handler (e.g. preload implementation) Change-Id: I4d917cdd7201039002d56e7780a7c5701327c16d Signed-off-by: Vasiliy Ulyanov --- uprobe/swap_uprobes.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/uprobe/swap_uprobes.c b/uprobe/swap_uprobes.c index 6f9237f..08d33f2 100644 --- a/uprobe/swap_uprobes.c +++ b/uprobe/swap_uprobes.c @@ -740,7 +740,10 @@ int trampoline_uprobe_handler(struct kprobe *p, struct pt_regs *regs) } spin_unlock_irqrestore(&uretprobe_lock, flags); - arch_set_orig_ret_addr(orig_ret_addr, regs); + /* orig_ret_addr is NULL when there is no need to restore anything + * (all the magic is performed inside handler) */ + if (likely(orig_ret_addr)) + arch_set_orig_ret_addr(orig_ret_addr, regs); return 1; } -- 2.7.4