write_lock(&key->lock);
long keyctl_setperm_key(key_serial_t id, key_perm_t perm){	struct key *key;	long ret;	ret = -EINVAL;	if (perm & ~(KEY_USR_ALL | KEY_GRP_ALL | KEY_OTH_ALL))		goto error;	key = lookup_user_key(id, 1, 1, 0);	if (IS_ERR(key)) {		ret = PTR_ERR(key);		goto error;	}	/* make the changes with the locks held to prevent chown/chmod	 * races */	ret = -EACCES;	down_write(&key->sem);	write_lock(&key->lock);	/* if we're not the sysadmin, we can only chmod a key that we	 * own */	if (!capable(CAP_SYS_ADMIN) && key->uid != current->fsuid)		goto no_access;	/* changing the permissions mask */	key->perm = perm;	ret = 0; no_access:	write_unlock(&key->lock);	up_write(&key->sem);	key_put(key); error:	return ret;} /* end keyctl_setperm_key() */