[IMPROVE] dbi_register_kprobe/dbi_unregister_kprobe 71/13871/4
authorAnastasia Lyupa <a.lyupa@samsung.com>
Tue, 17 Dec 2013 12:44:38 +0000 (16:44 +0400)
committerNikita Kalyazin <n.kalyazin@samsung.com>
Tue, 7 Jan 2014 05:40:06 +0000 (21:40 -0800)
set NULL addr in struct kprobe during unregistering if
symbol_name is set to make the struct reusable
(because we can't use symbol_name and addr to register kprobe
at the same time)

this commit reverts
commit 7ddb6434a343f484e3e0b2f1b720e77753e32800,
it solves the same problem in the other way

Change-Id: Ifac85e1f416c0c053711a0e5dd283c019c461097
Signed-off-by: Anastasia Lyupa <a.lyupa@samsung.com>
kprobe/dbi_kprobes.c

index 40ee61b..ec3f40d 100644 (file)
@@ -504,8 +504,11 @@ int dbi_register_kprobe(struct kprobe *p)
         * and add it to the address.  That way the addr
         * field can either be global or relative to a symbol.
         */
-       if (p->symbol_name)
+       if (p->symbol_name) {
+               if (p->addr)
+                       return -EINVAL;
                p->addr = (kprobe_opcode_t *)swap_ksyms(p->symbol_name);
+       }
 
        if (!p->addr)
                return -EINVAL;
@@ -601,6 +604,9 @@ valid_p:
                                old_p->post_handler = NULL;
                }
        }
+       /* Set NULL addr for reusability if symbol_name is used */
+       if (p->symbol_name)
+               p->addr = NULL;
 }
 
 int dbi_register_jprobe(struct jprobe *jp)