~ubuntu-branches/ubuntu/karmic/linux-mvl-dove/karmic-proposed

« back to all changes in this revision

Viewing changes to security/keys/keyring.c

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Bader, Stefan Bader, Ubuntu: 2.6.31-22.64
  • Date: 2010-08-20 14:39:28 UTC
  • mfrom: (15.1.5 karmic-security)
  • Revision ID: james.westby@ubuntu.com-20100820143928-3wx46t24cpshenrk
Tags: 2.6.31-214.31
[ Stefan Bader ]

* Rebased to 2.6.31-22.64

[ Ubuntu: 2.6.31-22.64 ]

* SAUCE: (no-up) Modularize vesafb -- fix initialization
  - LP: #611471
* SAUCE: sched: update load count only once per cpu in 10 tick update
  window
  - LP: #513848
* (pre-stable) x86-32, resume: do a global tlb flush in S4 resume
  - LP: #531309
* PCI: Ensure we re-enable devices on resume
  - LP: #566149

Show diffs side-by-side

added added

removed removed

Lines of Context:
524
524
        struct key *keyring;
525
525
        int bucket;
526
526
 
527
 
        keyring = ERR_PTR(-EINVAL);
528
527
        if (!name)
529
 
                goto error;
 
528
                return ERR_PTR(-EINVAL);
530
529
 
531
530
        bucket = keyring_hash(name);
532
531
 
553
552
                                           KEY_SEARCH) < 0)
554
553
                                continue;
555
554
 
556
 
                        /* we've got a match */
557
 
                        atomic_inc(&keyring->usage);
558
 
                        read_unlock(&keyring_name_lock);
559
 
                        goto error;
 
555
                        /* we've got a match but we might end up racing with
 
556
                         * key_cleanup() if the keyring is currently 'dead'
 
557
                         * (ie. it has a zero usage count) */
 
558
                        if (!atomic_inc_not_zero(&keyring->usage))
 
559
                                continue;
 
560
                        goto out;
560
561
                }
561
562
        }
562
563
 
 
564
        keyring = ERR_PTR(-ENOKEY);
 
565
out:
563
566
        read_unlock(&keyring_name_lock);
564
 
        keyring = ERR_PTR(-ENOKEY);
565
 
 
566
 
 error:
567
567
        return keyring;
568
568
 
569
569
} /* end find_keyring_by_name() */