[IMPROVE] Add orig_ret_addr restore condition 54/33654/2
authorVasiliy Ulyanov <v.ulyanov@samsung.com>
Wed, 4 Jun 2014 08:16:33 +0000 (12:16 +0400)
committerAlexander Aksenov <a.aksenov@samsung.com>
Tue, 24 Feb 2015 08:18:31 +0000 (11:18 +0300)
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 <v.ulyanov@samsung.com>
uprobe/swap_uprobes.c

index 6f9237f..08d33f2 100644 (file)
@@ -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;
 }