From: Vasiliy Ulyanov Date: Wed, 4 Jun 2014 08:16:33 +0000 (+0400) Subject: [IMPROVE] Add orig_ret_addr restore condition X-Git-Tag: submit/tizen/20151123.110932~102 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F54%2F33654%2F2;p=kernel%2Fswap-modules.git [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 --- 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; }