Re: [PATCH v4 2/2] s390/vfio-ap: control access to PQAP(AQIC) interception handler

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

 



On Fri, May 21, 2021 at 03:36:48PM -0400, Tony Krowiak wrote:
> +static struct kvm_s390_crypto_hook
> +*kvm_arch_crypto_find_hook(enum kvm_s390_crypto_hook_type type)
> +{
> +	struct kvm_s390_crypto_hook *crypto_hook;
> +
> +	list_for_each_entry(crypto_hook, &crypto_hooks, node) {
> +		if (crypto_hook->type == type)
> +			return crypto_hook;
> +	}
> +
> +	return NULL;
> +}
> +
> +int kvm_arch_crypto_register_hook(struct kvm_s390_crypto_hook *hook)
> +{
> +	struct kvm_s390_crypto_hook *crypto_hook;
> +
> +	mutex_lock(&crypto_hooks_lock);
> +	crypto_hook = kvm_arch_crypto_find_hook(hook->type);
> +	if (crypto_hook) {
> +		if (crypto_hook->owner != hook->owner)
> +			return -EACCES;
> +		list_replace(&crypto_hook->node, &hook->node);

This is all dead code right? This is only called from a module init
function so it can't be called twice. Just always fail if the hook is
already used and delete the owner stuff.

But this is alot of complicated and unused code to solve a lock
ordering problem..

Jason



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux