Re: [PATCH v10 02/12] block: Keyslot Manager for Inline Encryption

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> +bool blk_ksm_crypto_cfg_supported(struct blk_keyslot_manager *ksm,
> +				  const struct blk_crypto_config *cfg)
> +{
> +	if (!ksm)
> +		return false;
> +	return (ksm->crypto_modes_supported[cfg->crypto_mode] &
> +		cfg->data_unit_size) &&
> +	       (ksm->max_dun_bytes_supported >= cfg->dun_bytes);

Nit: why not expand this a bit to be more readable:

	if (!(ksm->crypto_modes_supported[cfg->crypto_mode] &
			cfg->data_unit_size))
		return false;
	if (ksm->max_dun_bytes_supported < cfg->dun_bytes)
		return false;
	return true;

> +int blk_ksm_evict_key(struct blk_keyslot_manager *ksm,
> +		      const struct blk_crypto_key *key)
> +{
> +	struct blk_ksm_keyslot *slot;
> +	int err = 0;
> +
> +	blk_ksm_hw_enter(ksm);
> +	slot = blk_ksm_find_keyslot(ksm, key);
> +	if (!slot)
> +		goto out_unlock;
> +
> +	if (atomic_read(&slot->slot_refs) != 0) {
> +		err = -EBUSY;
> +		goto out_unlock;
> +	}

This check looks racy.



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux