diff options
author | Vyacheslav Cherkashin <v.cherkashin@samsung.com> | 2013-03-28 15:38:57 +0400 |
---|---|---|
committer | Vyacheslav Cherkashin <v.cherkashin@samsung.com> | 2013-03-28 15:39:18 +0400 |
commit | 97f67247cc7ec78409b161a98ec5068ae0eccaad (patch) | |
tree | 2503ca2e21effedbe5d0d7fb804d28841aed736e /uprobe | |
parent | 87ea9065f8e7ff02e98929bd44c0319ff7e3d565 (diff) | |
download | swap-modules-97f67247cc7ec78409b161a98ec5068ae0eccaad.tar.gz swap-modules-97f67247cc7ec78409b161a98ec5068ae0eccaad.tar.bz2 swap-modules-97f67247cc7ec78409b161a98ec5068ae0eccaad.zip |
[REFACTOR] create and use recycle_urp_inst()
Diffstat (limited to 'uprobe')
-rw-r--r-- | uprobe/arch/asm-arm/swap_uprobes.c | 2 | ||||
-rw-r--r-- | uprobe/swap_uprobes.c | 15 | ||||
-rw-r--r-- | uprobe/swap_uprobes.h | 1 |
3 files changed, 16 insertions, 2 deletions
diff --git a/uprobe/arch/asm-arm/swap_uprobes.c b/uprobe/arch/asm-arm/swap_uprobes.c index dea907bf..c35e7d0d 100644 --- a/uprobe/arch/asm-arm/swap_uprobes.c +++ b/uprobe/arch/asm-arm/swap_uprobes.c @@ -672,7 +672,7 @@ int trampoline_uprobe_handler(struct kprobe *p, struct pt_regs *regs) } orig_ret_address = (unsigned long)ri->ret_addr; - recycle_rp_inst(ri); + recycle_urp_inst(ri); if (orig_ret_address != trampoline_address) { /* diff --git a/uprobe/swap_uprobes.c b/uprobe/swap_uprobes.c index 56cb7b98..6e7bc4bf 100644 --- a/uprobe/swap_uprobes.c +++ b/uprobe/swap_uprobes.c @@ -413,6 +413,19 @@ static void add_urp_inst(struct kretprobe_instance *ri) } /* Called with uretprobe_lock held */ +void recycle_urp_inst(struct kretprobe_instance *ri) +{ + if (ri->rp) { + hlist_del(&ri->hlist); + /* remove rp inst off the used list */ + hlist_del(&ri->uflist); + /* put rp inst back onto the free list */ + INIT_HLIST_NODE(&ri->uflist); + hlist_add_head(&ri->uflist, &ri->rp->free_instances); + } +} + +/* Called with uretprobe_lock held */ static struct kretprobe_instance *get_used_urp_inst(struct kretprobe *rp) { struct hlist_node *node; @@ -841,7 +854,7 @@ void dbi_unregister_uretprobe(struct task_struct *task, struct kretprobe *rp, in /*panic*/printk("%s (%d/%d): cannot disarm urp instance (%08lx)\n", ri->task->comm, ri->task->tgid, ri->task->pid, (unsigned long)rp->kp.addr); - recycle_rp_inst(ri); + recycle_urp_inst(ri); } if (hlist_empty(&rp->used_instances) || not_rp2) { diff --git a/uprobe/swap_uprobes.h b/uprobe/swap_uprobes.h index 0385c1fc..5b6d5d2d 100644 --- a/uprobe/swap_uprobes.h +++ b/uprobe/swap_uprobes.h @@ -47,5 +47,6 @@ void disarm_uprobe(struct kprobe *p, struct task_struct *task); extern spinlock_t uretprobe_lock; struct hlist_head *uretprobe_inst_table_head(void *hash_key); +void recycle_urp_inst(struct kretprobe_instance *ri); #endif /* _DBI_UPROBES_H */ |