From 493fa574864f013157ac69dc6cccda3b61939752 Mon Sep 17 00:00:00 2001 From: Anastasia Lyupa Date: Tue, 17 Dec 2013 16:44:38 +0400 Subject: [PATCH] [IMPROVE] dbi_register_kprobe/dbi_unregister_kprobe 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 --- kprobe/dbi_kprobes.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kprobe/dbi_kprobes.c b/kprobe/dbi_kprobes.c index 40ee61b..ec3f40d 100644 --- a/kprobe/dbi_kprobes.c +++ b/kprobe/dbi_kprobes.c @@ -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) -- 2.7.4