return NULL;
}
+/* Called with uretprobe_lock held */
+struct kretprobe_instance *get_free_urp_inst_no_alloc (struct kretprobe *rp)
+{
+ struct hlist_node *node;
+ struct kretprobe_instance *ri;
+
+ hlist_for_each_entry (ri, node, &rp->free_instances, uflist) {
+ return ri;
+ }
+
+ return NULL;
+}
+
+/* Called with uretprobe_lock held */
+static void free_urp_inst(struct kretprobe *rp)
+{
+ struct kretprobe_instance *ri;
+ while ((ri = get_free_urp_inst_no_alloc(rp)) != NULL) {
+ hlist_del(&ri->uflist);
+ kfree(ri);
+ }
+}
+
#define COMMON_URP_NR 10
static int alloc_nodes_uretprobe(struct kretprobe *rp)
for (i = 0; i < alloc_nodes; ++i) {
inst = kmalloc(sizeof(*inst), GFP_ATOMIC);
if (inst == NULL) {
- free_rp_inst(rp);
+ free_urp_inst(rp);
return -ENOMEM;
}
INIT_HLIST_NODE(&inst->uflist);
for (i = 0; i < rp->maxactive; i++) {
inst = kmalloc(sizeof(*inst), GFP_KERNEL);
if (inst == NULL) {
- free_rp_inst (rp);
+ free_urp_inst(rp);
ret = -ENOMEM;
goto out;
}
/* Establish function entry probe point */
ret = dbi_register_uprobe(&rp->kp, task, atomic);
if (ret) {
- free_rp_inst(rp);
+ free_urp_inst(rp);
goto out;
}
}
spin_unlock_irqrestore(&uretprobe_lock, flags);
- free_rp_inst(rp);
+ free_urp_inst(rp);
dbi_unregister_uprobe(&rp->kp, task, atomic);
}