lkml.org 
[lkml]   [2021]   [May]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4 2/2] s390/vfio-ap: control access to PQAP(AQIC) interception handler
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

\
 
 \ /
  Last update: 2021-05-24 00:59    [W:0.123 / U:1.500 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site