diff options
Diffstat (limited to 'kernel/kprobes.c')
-rw-r--r-- | kernel/kprobes.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/kernel/kprobes.c b/kernel/kprobes.c index e5d84644823b..9788c0ec6f43 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c | |||
@@ -1077,6 +1077,7 @@ void __kprobes kprobe_flush_task(struct task_struct *tk) | |||
1077 | /* Early boot. kretprobe_table_locks not yet initialized. */ | 1077 | /* Early boot. kretprobe_table_locks not yet initialized. */ |
1078 | return; | 1078 | return; |
1079 | 1079 | ||
1080 | INIT_HLIST_HEAD(&empty_rp); | ||
1080 | hash = hash_ptr(tk, KPROBE_HASH_BITS); | 1081 | hash = hash_ptr(tk, KPROBE_HASH_BITS); |
1081 | head = &kretprobe_inst_table[hash]; | 1082 | head = &kretprobe_inst_table[hash]; |
1082 | kretprobe_table_lock(hash, &flags); | 1083 | kretprobe_table_lock(hash, &flags); |
@@ -1085,7 +1086,6 @@ void __kprobes kprobe_flush_task(struct task_struct *tk) | |||
1085 | recycle_rp_inst(ri, &empty_rp); | 1086 | recycle_rp_inst(ri, &empty_rp); |
1086 | } | 1087 | } |
1087 | kretprobe_table_unlock(hash, &flags); | 1088 | kretprobe_table_unlock(hash, &flags); |
1088 | INIT_HLIST_HEAD(&empty_rp); | ||
1089 | hlist_for_each_entry_safe(ri, node, tmp, &empty_rp, hlist) { | 1089 | hlist_for_each_entry_safe(ri, node, tmp, &empty_rp, hlist) { |
1090 | hlist_del(&ri->hlist); | 1090 | hlist_del(&ri->hlist); |
1091 | kfree(ri); | 1091 | kfree(ri); |
@@ -1673,8 +1673,12 @@ static int __kprobes pre_handler_kretprobe(struct kprobe *p, | |||
1673 | ri->rp = rp; | 1673 | ri->rp = rp; |
1674 | ri->task = current; | 1674 | ri->task = current; |
1675 | 1675 | ||
1676 | if (rp->entry_handler && rp->entry_handler(ri, regs)) | 1676 | if (rp->entry_handler && rp->entry_handler(ri, regs)) { |
1677 | raw_spin_lock_irqsave(&rp->lock, flags); | ||
1678 | hlist_add_head(&ri->hlist, &rp->free_instances); | ||
1679 | raw_spin_unlock_irqrestore(&rp->lock, flags); | ||
1677 | return 0; | 1680 | return 0; |
1681 | } | ||
1678 | 1682 | ||
1679 | arch_prepare_kretprobe(ri, regs); | 1683 | arch_prepare_kretprobe(ri, regs); |
1680 | 1684 | ||
@@ -2198,7 +2202,7 @@ static ssize_t write_enabled_file_bool(struct file *file, | |||
2198 | const char __user *user_buf, size_t count, loff_t *ppos) | 2202 | const char __user *user_buf, size_t count, loff_t *ppos) |
2199 | { | 2203 | { |
2200 | char buf[32]; | 2204 | char buf[32]; |
2201 | int buf_size; | 2205 | size_t buf_size; |
2202 | 2206 | ||
2203 | buf_size = min(count, (sizeof(buf)-1)); | 2207 | buf_size = min(count, (sizeof(buf)-1)); |
2204 | if (copy_from_user(buf, user_buf, buf_size)) | 2208 | if (copy_from_user(buf, user_buf, buf_size)) |