Re: [PATCH v18 13/18] s390/vfio-ap: implement in-use callback for vfio_ap driver

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

 





On 3/22/22 09:13, Jason J. Herne wrote:
On 2/14/22 19:50, Tony Krowiak wrote:
...
diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c
index e9f7ec6fc6a5..63dfb9b89581 100644
--- a/drivers/s390/crypto/vfio_ap_ops.c
+++ b/drivers/s390/crypto/vfio_ap_ops.c
@@ -617,10 +617,32 @@ static int vfio_ap_mdev_verify_no_sharing(unsigned long *mdev_apm,
      return 0;
  }
  +/**
+ * vfio_ap_mdev_validate_masks - verify that the APQNs assigned to the mdev are
+ *                 not reserved for the default zcrypt driver and
+ *                 are not assigned to another mdev.
+ *
+ * @matrix_mdev: the mdev to which the APQNs being validated are assigned.
+ *
+ * Return: One of the following values:
+ * o the error returned from the ap_apqn_in_matrix_owned_by_def_drv() function, + *   most likely -EBUSY indicating the ap_perms_mutex lock is already held. + * o EADDRNOTAVAIL if an APQN assigned to @matrix_mdev is reserved for the
+ *           zcrypt default driver.
+ * o EADDRINUSE if an APQN assigned to @matrix_mdev is assigned to another mdev
+ * o A zero indicating validation succeeded.
+ */
  static int vfio_ap_mdev_validate_masks(struct ap_matrix_mdev *matrix_mdev)
  {
-    if (ap_apqn_in_matrix_owned_by_def_drv(matrix_mdev->matrix.apm,
-                           matrix_mdev->matrix.aqm))
+    int ret;
+
+    ret = ap_apqn_in_matrix_owned_by_def_drv(matrix_mdev->matrix.apm,
+                         matrix_mdev->matrix.aqm);
+
+    if (ret < 0)
+        return ret;
+
+    if (ret == 1)
          return -EADDRNOTAVAIL;

I took a look at ap_apqn_in_matrix_owned_by_def_drv(). It appears that this function can only ever return 0 or 1. This patch is changed to watch for a negative return
value from ap_apqn_in_matrix_owned_by_def_drv(). Am I missing something?

That's odd, careless error, I'll fix it.







[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