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 Tue, May 25, 2021 at 11:08:22AM -0400, Tony Krowiak wrote:

> > Why can't you put the locks in the right order? It looked trivial, I'm confused.
> 
> Because the handle_pqap() function in priv.c does not have access to the
> matrix_dev lock.

Based on the sketch  made the handle_pqap() should only handle the
arch.crypto.rwsem.

When it calls the hook it gets the matrix dev

This sets the lock order as always: rwsem then matrix_dev

Of the other two places:

@@ -352,8 +352,7 @@ static int vfio_ap_mdev_create(struct mdev_device *mdev)
+       down_write(&&vcpu->kvm->arch.crypto.rwsem);
        mutex_lock(&matrix_dev->lock);

Obviously correct

@@ -1202,7 +1203,9 @@ static void vfio_ap_mdev_unset_kvm(struct ap_matrix_mdev *matrix_mdev)
                mutex_lock(&matrix_dev->lock);
                vfio_ap_mdev_reset_queues(matrix_mdev->mdev);
+               down_write(&matrix_mdev->kvm->arch.crypto.rwsem);
                matrix_mdev->kvm->arch.crypto.pqap_hook = NULL;
+               up_write(&matrix_mdev->kvm->arch.crypto.rwsem);

This is inverted

Just move the down_write up two lines

What is missing?

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