mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] KVM: s390: pci: Fix GISC refcount leak on AIF enable failure
@ 2026-06-24  6:19 Haoxiang Li
  2026-06-24  8:42 ` Claudio Imbrenda
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Haoxiang Li @ 2026-06-24  6:19 UTC (permalink / raw)
  To: mjrosato, alifm, farman, borntraeger, frankja, imbrenda, david,
	hca, gor, agordeev, svens, schnelle
  Cc: linux-s390, kvm, linux-kernel, Haoxiang Li, stable

kvm_s390_gisc_register() registers the guest ISC before pinning
the guest interrupt forwarding pages and allocating the AISB bit.
If any of the later setup steps fails, the function unwinds the
pinned pages and other local state, but does not unregister the
GISC reference. Add the missing kvm_s390_gisc_unregister() to the
error unwind path.

Fixes: 3c5a1b6f0a18 ("KVM: s390: pci: provide routines for enabling/disabling interrupt forwarding")
Cc: stable@vger.kernel.org
Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
---
Changes in v2:
 - Move unregister call after "out" label. Thanks, Matt!
---
 arch/s390/kvm/pci.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/s390/kvm/pci.c b/arch/s390/kvm/pci.c
index 5b075c38998e..686113be0530 100644
--- a/arch/s390/kvm/pci.c
+++ b/arch/s390/kvm/pci.c
@@ -328,6 +328,7 @@ static int kvm_s390_pci_aif_enable(struct zpci_dev *zdev, struct zpci_fib *fib,
 unpin1:
 	unpin_user_page(aibv_page);
 out:
+	kvm_s390_gisc_unregister(kvm, fib->fmt0.isc);
 	return rc;
 }
 
-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] KVM: s390: pci: Fix GISC refcount leak on AIF enable failure
  2026-06-24  6:19 [PATCH v2] KVM: s390: pci: Fix GISC refcount leak on AIF enable failure Haoxiang Li
@ 2026-06-24  8:42 ` Claudio Imbrenda
  2026-06-24 17:58 ` Matthew Rosato
  2026-06-25 10:42 ` Christian Borntraeger
  2 siblings, 0 replies; 4+ messages in thread
From: Claudio Imbrenda @ 2026-06-24  8:42 UTC (permalink / raw)
  To: Haoxiang Li
  Cc: mjrosato, alifm, farman, borntraeger, frankja, david, hca, gor,
	agordeev, svens, schnelle, linux-s390, kvm, linux-kernel, stable

On Wed, 24 Jun 2026 14:19:10 +0800
Haoxiang Li <haoxiang_li2024@163.com> wrote:

> kvm_s390_gisc_register() registers the guest ISC before pinning
> the guest interrupt forwarding pages and allocating the AISB bit.
> If any of the later setup steps fails, the function unwinds the
> pinned pages and other local state, but does not unregister the
> GISC reference. Add the missing kvm_s390_gisc_unregister() to the
> error unwind path.
> 
> Fixes: 3c5a1b6f0a18 ("KVM: s390: pci: provide routines for enabling/disabling interrupt forwarding")
> Cc: stable@vger.kernel.org
> Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>

Acked-by: Claudio Imbrenda <imbrenda@linux.ibm.com>

> ---
> Changes in v2:
>  - Move unregister call after "out" label. Thanks, Matt!
> ---
>  arch/s390/kvm/pci.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/s390/kvm/pci.c b/arch/s390/kvm/pci.c
> index 5b075c38998e..686113be0530 100644
> --- a/arch/s390/kvm/pci.c
> +++ b/arch/s390/kvm/pci.c
> @@ -328,6 +328,7 @@ static int kvm_s390_pci_aif_enable(struct zpci_dev *zdev, struct zpci_fib *fib,
>  unpin1:
>  	unpin_user_page(aibv_page);
>  out:
> +	kvm_s390_gisc_unregister(kvm, fib->fmt0.isc);
>  	return rc;
>  }
>  


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] KVM: s390: pci: Fix GISC refcount leak on AIF enable failure
  2026-06-24  6:19 [PATCH v2] KVM: s390: pci: Fix GISC refcount leak on AIF enable failure Haoxiang Li
  2026-06-24  8:42 ` Claudio Imbrenda
@ 2026-06-24 17:58 ` Matthew Rosato
  2026-06-25 10:42 ` Christian Borntraeger
  2 siblings, 0 replies; 4+ messages in thread
From: Matthew Rosato @ 2026-06-24 17:58 UTC (permalink / raw)
  To: Haoxiang Li, alifm, farman, borntraeger, frankja, imbrenda,
	david, hca, gor, agordeev, svens, schnelle
  Cc: linux-s390, kvm, linux-kernel, stable

On 6/24/26 2:19 AM, Haoxiang Li wrote:
> kvm_s390_gisc_register() registers the guest ISC before pinning
> the guest interrupt forwarding pages and allocating the AISB bit.
> If any of the later setup steps fails, the function unwinds the
> pinned pages and other local state, but does not unregister the
> GISC reference. Add the missing kvm_s390_gisc_unregister() to the
> error unwind path.
> 
> Fixes: 3c5a1b6f0a18 ("KVM: s390: pci: provide routines for enabling/disabling interrupt forwarding")
> Cc: stable@vger.kernel.org
> Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>

Thanks, code looks good:

Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>

Forced the codepath in question on s390 w/ passthrough devices, so feel
free to also add:

Tested-by: Matthew Rosato <mjrosato@linux.ibm.com>

> ---
> Changes in v2:
>  - Move unregister call after "out" label. Thanks, Matt!
> ---
>  arch/s390/kvm/pci.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/s390/kvm/pci.c b/arch/s390/kvm/pci.c
> index 5b075c38998e..686113be0530 100644
> --- a/arch/s390/kvm/pci.c
> +++ b/arch/s390/kvm/pci.c
> @@ -328,6 +328,7 @@ static int kvm_s390_pci_aif_enable(struct zpci_dev *zdev, struct zpci_fib *fib,
>  unpin1:
>  	unpin_user_page(aibv_page);
>  out:
> +	kvm_s390_gisc_unregister(kvm, fib->fmt0.isc);
>  	return rc;
>  }
>  


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] KVM: s390: pci: Fix GISC refcount leak on AIF enable failure
  2026-06-24  6:19 [PATCH v2] KVM: s390: pci: Fix GISC refcount leak on AIF enable failure Haoxiang Li
  2026-06-24  8:42 ` Claudio Imbrenda
  2026-06-24 17:58 ` Matthew Rosato
@ 2026-06-25 10:42 ` Christian Borntraeger
  2 siblings, 0 replies; 4+ messages in thread
From: Christian Borntraeger @ 2026-06-25 10:42 UTC (permalink / raw)
  To: Haoxiang Li, mjrosato, alifm, farman, frankja, imbrenda, david,
	hca, gor, agordeev, svens, schnelle
  Cc: linux-s390, kvm, linux-kernel, stable

Am 24.06.26 um 08:19 schrieb Haoxiang Li:
> kvm_s390_gisc_register() registers the guest ISC before pinning
> the guest interrupt forwarding pages and allocating the AISB bit.
> If any of the later setup steps fails, the function unwinds the
> pinned pages and other local state, but does not unregister the
> GISC reference. Add the missing kvm_s390_gisc_unregister() to the
> error unwind path.
> 
> Fixes: 3c5a1b6f0a18 ("KVM: s390: pci: provide routines for enabling/disabling interrupt forwarding")
> Cc: stable@vger.kernel.org
> Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
> ---
> Changes in v2:
>   - Move unregister call after "out" label. Thanks, Matt!
Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>

applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-06-25 10:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-24  6:19 [PATCH v2] KVM: s390: pci: Fix GISC refcount leak on AIF enable failure Haoxiang Li
2026-06-24  8:42 ` Claudio Imbrenda
2026-06-24 17:58 ` Matthew Rosato
2026-06-25 10:42 ` Christian Borntraeger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox