Showing error 947

User: Jiri Slaby
Error type: Leaving function in locked state
Error type description: Some lock is not unlocked on all paths of a function, so it is leaked
File location: mm/mmap.c
Line in file: 2414
Project: Linux Kernel
Project version: 2.6.28
Tools: Stanse (1.2)
Entered: 2012-03-02 21:35:17 UTC


Source:

2384 */
2385int mm_take_all_locks(struct mm_struct *mm)
2386{
2387        struct vm_area_struct *vma;
2388        int ret = -EINTR;
2389
2390        BUG_ON(down_read_trylock(&mm->mmap_sem));
2391
2392        mutex_lock(&mm_all_locks_mutex);
2393
2394        for (vma = mm->mmap; vma; vma = vma->vm_next) {
2395                if (signal_pending(current))
2396                        goto out_unlock;
2397                if (vma->vm_file && vma->vm_file->f_mapping)
2398                        vm_lock_mapping(mm, vma->vm_file->f_mapping);
2399        }
2400
2401        for (vma = mm->mmap; vma; vma = vma->vm_next) {
2402                if (signal_pending(current))
2403                        goto out_unlock;
2404                if (vma->anon_vma)
2405                        vm_lock_anon_vma(mm, vma->anon_vma);
2406        }
2407
2408        ret = 0;
2409
2410out_unlock:
2411        if (ret)
2412                mm_drop_all_locks(mm);
2413
2414        return ret;
2415}
2416
2417static void vm_unlock_anon_vma(struct anon_vma *anon_vma)
2418{
2419        if (test_bit(0, (unsigned long *) &anon_vma->head.next)) {
2420                /*
2421                 * The LSB of head.next can't change to 0 from under
2422                 * us because we hold the mm_all_locks_mutex.
2423                 *
2424                 * We must however clear the bitflag before unlocking
Show full sources