* [PATCH 1/2] s390/vfio-ap: unpin pages on gisc registration failure
[not found] <20230913130626.217665-1-akrowiak@linux.ibm.com>
@ 2023-09-13 13:06 ` Tony Krowiak
2023-09-13 18:10 ` Matthew Rosato
0 siblings, 1 reply; 3+ messages in thread
From: Tony Krowiak @ 2023-09-13 13:06 UTC (permalink / raw)
To: linux-s390, linux-kernel, kvm
Cc: jjherne, pasic, alex.williamson, borntraeger, kwankhede, frankja,
imbrenda, david, Anthony Krowiak, stable
From: Anthony Krowiak <akrowiak@linux.ibm.com>
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.
Fixes: 783f0a3ccd79 ("s390/vfio-ap: add s390dbf logging to the vfio_ap_irq_enable function")
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Signed-off-by: Anthony Krowiak <akrowiak@linux.ibm.com>
Cc: <stable@vger.kernel.org>
---
drivers/s390/crypto/vfio_ap_ops.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c
index 4db538a55192..9cb28978c186 100644
--- a/drivers/s390/crypto/vfio_ap_ops.c
+++ b/drivers/s390/crypto/vfio_ap_ops.c
@@ -457,6 +457,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;
}
--
2.41.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] s390/vfio-ap: unpin pages on gisc registration failure
2023-09-13 13:06 ` [PATCH 1/2] s390/vfio-ap: unpin pages on gisc registration failure Tony Krowiak
@ 2023-09-13 18:10 ` Matthew Rosato
2023-09-15 13:16 ` Tony Krowiak
0 siblings, 1 reply; 3+ messages in thread
From: Matthew Rosato @ 2023-09-13 18:10 UTC (permalink / raw)
To: Tony Krowiak, linux-s390, linux-kernel, kvm
Cc: jjherne, pasic, alex.williamson, borntraeger, kwankhede, frankja,
imbrenda, david, stable
On 9/13/23 9:06 AM, Tony Krowiak wrote:
> From: Anthony Krowiak <akrowiak@linux.ibm.com>
>
> 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.
>
> Fixes: 783f0a3ccd79 ("s390/vfio-ap: add s390dbf logging to the vfio_ap_irq_enable function")
>
> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
> Signed-off-by: Anthony Krowiak <akrowiak@linux.ibm.com>
> Cc: <stable@vger.kernel.org>
Oops, good find.
Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
> ---
> drivers/s390/crypto/vfio_ap_ops.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c
> index 4db538a55192..9cb28978c186 100644
> --- a/drivers/s390/crypto/vfio_ap_ops.c
> +++ b/drivers/s390/crypto/vfio_ap_ops.c
> @@ -457,6 +457,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;
> }
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] s390/vfio-ap: unpin pages on gisc registration failure
2023-09-13 18:10 ` Matthew Rosato
@ 2023-09-15 13:16 ` Tony Krowiak
0 siblings, 0 replies; 3+ messages in thread
From: Tony Krowiak @ 2023-09-15 13:16 UTC (permalink / raw)
To: Matthew Rosato, linux-s390, linux-kernel, kvm
Cc: jjherne, pasic, alex.williamson, borntraeger, kwankhede, frankja,
imbrenda, david, stable
On 9/13/23 14:10, Matthew Rosato wrote:
> On 9/13/23 9:06 AM, Tony Krowiak wrote:
>> From: Anthony Krowiak <akrowiak@linux.ibm.com>
>>
>> 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.
>>
>> Fixes: 783f0a3ccd79 ("s390/vfio-ap: add s390dbf logging to the vfio_ap_irq_enable function")
>>
>> Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
>> Signed-off-by: Anthony Krowiak <akrowiak@linux.ibm.com>
>> Cc: <stable@vger.kernel.org>
>
> Oops, good find.
Yes, thanks to Janosch/
>
> Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
>
>> ---
>> drivers/s390/crypto/vfio_ap_ops.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c
>> index 4db538a55192..9cb28978c186 100644
>> --- a/drivers/s390/crypto/vfio_ap_ops.c
>> +++ b/drivers/s390/crypto/vfio_ap_ops.c
>> @@ -457,6 +457,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;
>> }
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-09-15 13:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20230913130626.217665-1-akrowiak@linux.ibm.com>
2023-09-13 13:06 ` [PATCH 1/2] s390/vfio-ap: unpin pages on gisc registration failure Tony Krowiak
2023-09-13 18:10 ` Matthew Rosato
2023-09-15 13:16 ` Tony Krowiak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox