User: | Jiri Slaby |
Error type: | Double Unlock |
Error type description: | Some lock is unlocked twice unintentionally in a sequence |
File location: | kernel/kprobes.c |
Line in file: | 905 |
Project: | Linux Kernel |
Project version: | 2.6.28 |
Confirmation: | Fixed by f02b8624fedca39886b0eef770dca70c2f0749b3 |
Tools: |
Stanse
(1.2)
Smatch (1.59) |
Entered: | 2011-11-07 22:20:57 UTC |
875 if (jps[i]->kp.addr) 876 __unregister_kprobe_bottom(&jps[i]->kp); 877 } 878} 879 880#ifdef CONFIG_KRETPROBES 881/* 882 * This kprobe pre_handler is registered with every kretprobe. When probe 883 * hits it will set up the return probe. 884 */ 885static int __kprobes pre_handler_kretprobe(struct kprobe *p, 886 struct pt_regs *regs) 887{ 888 struct kretprobe *rp = container_of(p, struct kretprobe, kp); 889 unsigned long hash, flags = 0; 890 struct kretprobe_instance *ri; 891 892 /*TODO: consider to only swap the RA after the last pre_handler fired */ 893 hash = hash_ptr(current, KPROBE_HASH_BITS); 894 spin_lock_irqsave(&rp->lock, flags); 895 if (!hlist_empty(&rp->free_instances)) { 896 ri = hlist_entry(rp->free_instances.first, 897 struct kretprobe_instance, hlist); 898 hlist_del(&ri->hlist); 899 spin_unlock_irqrestore(&rp->lock, flags); 900 901 ri->rp = rp; 902 ri->task = current; 903 904 if (rp->entry_handler && rp->entry_handler(ri, regs)) { 905 spin_unlock_irqrestore(&rp->lock, flags); 906 return 0; 907 } 908 909 arch_prepare_kretprobe(ri, regs); 910 911 /* XXX(hch): why is there no hlist_move_head? */ 912 INIT_HLIST_NODE(&ri->hlist); 913 kretprobe_table_lock(hash, &flags); 914 hlist_add_head(&ri->hlist, &kretprobe_inst_table[hash]); 915 kretprobe_table_unlock(hash, &flags);