Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'for-linus2' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security

Pull key handling bugfix from James Morris:
"Fix a race between keyctl_read() and keyctl_revoke()"

* 'for-linus2' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security:
KEYS: Fix race between read and revoke

+9 -9
+9 -9
security/keys/keyctl.c
··· 751 751 752 752 /* the key is probably readable - now try to read it */ 753 753 can_read_key: 754 - ret = key_validate(key); 755 - if (ret == 0) { 756 - ret = -EOPNOTSUPP; 757 - if (key->type->read) { 758 - /* read the data with the semaphore held (since we 759 - * might sleep) */ 760 - down_read(&key->sem); 754 + ret = -EOPNOTSUPP; 755 + if (key->type->read) { 756 + /* Read the data with the semaphore held (since we might sleep) 757 + * to protect against the key being updated or revoked. 758 + */ 759 + down_read(&key->sem); 760 + ret = key_validate(key); 761 + if (ret == 0) 761 762 ret = key->type->read(key, buffer, buflen); 762 - up_read(&key->sem); 763 - } 763 + up_read(&key->sem); 764 764 } 765 765 766 766 error2: