summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAnthony Krowiak <akrowiak@linux.ibm.com>2023-11-09 11:44:20 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-01-31 16:16:58 -0800
commitf4518de40a212c14f043fc9cfeaab3b4076c2cf8 (patch)
tree3ff60a7155cc402d763d1ab3dd10c3786dd18aee /drivers
parentdbc9a791a70ea47be9f2acf251700fe254a2ab23 (diff)
downloadlinux-stable-f4518de40a212c14f043fc9cfeaab3b4076c2cf8.tar.gz
linux-stable-f4518de40a212c14f043fc9cfeaab3b4076c2cf8.tar.bz2
linux-stable-f4518de40a212c14f043fc9cfeaab3b4076c2cf8.zip
s390/vfio-ap: unpin pages on gisc registration failure
commit 7b2d039da622daa9ba259ac6f38701d542b237c3 upstream. In the vfio_ap_irq_enable function, after the page containing the notification indicator byte (NIB) is pinned, the function attempts to register the guest ISC. If registration fails, the function sets the status response code and returns without unpinning the page containing the NIB. In order to avoid a memory leak, the NIB should be unpinned before returning from the vfio_ap_irq_enable function. Co-developed-by: Janosch Frank <frankja@linux.ibm.com> Signed-off-by: Janosch Frank <frankja@linux.ibm.com> Signed-off-by: Anthony Krowiak <akrowiak@linux.ibm.com> Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com> Fixes: 783f0a3ccd79 ("s390/vfio-ap: add s390dbf logging to the vfio_ap_irq_enable function") Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20231109164427.460493-2-akrowiak@linux.ibm.com Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/s390/crypto/vfio_ap_ops.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c
index 934515959ebf..b8c933ee13a0 100644
--- a/drivers/s390/crypto/vfio_ap_ops.c
+++ b/drivers/s390/crypto/vfio_ap_ops.c
@@ -425,6 +425,7 @@ static struct ap_queue_status vfio_ap_irq_enable(struct vfio_ap_queue *q,
VFIO_AP_DBF_WARN("%s: gisc registration failed: nisc=%d, isc=%d, apqn=%#04x\n",
__func__, nisc, isc, q->apqn);
+ vfio_unpin_pages(&q->matrix_mdev->vdev, nib, 1);
status.response_code = AP_RESPONSE_INVALID_GISA;
return status;
}