[PATCH v2 5/8] KVM: s390: vsie: Fix refcount overflow for shadow gmaps

Claudio Imbrenda posted 8 patches 2 weeks ago
There is a newer version of this series
[PATCH v2 5/8] KVM: s390: vsie: Fix refcount overflow for shadow gmaps
Posted by Claudio Imbrenda 2 weeks ago
In most cases gmap_put() was not called when it should have.

Add the missing gmap_put() in vsie_run().

Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Fixes: e38c884df921 ("KVM: s390: Switch to new gmap")
---
 arch/s390/kvm/vsie.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c
index 0330829b4046..72895dddc39a 100644
--- a/arch/s390/kvm/vsie.c
+++ b/arch/s390/kvm/vsie.c
@@ -1328,7 +1328,7 @@ static void unregister_shadow_scb(struct kvm_vcpu *vcpu)
 static int vsie_run(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
 {
 	struct kvm_s390_sie_block *scb_s = &vsie_page->scb_s;
-	struct gmap *sg;
+	struct gmap *sg = NULL;
 	int rc = 0;
 
 	while (1) {
@@ -1368,6 +1368,8 @@ static int vsie_run(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
 			sg = gmap_put(sg);
 		cond_resched();
 	}
+	if (sg)
+		sg = gmap_put(sg);
 
 	if (rc == -EFAULT) {
 		/*
-- 
2.53.0
Re: [PATCH v2 5/8] KVM: s390: vsie: Fix refcount overflow for shadow gmaps
Posted by Janosch Frank 1 week, 3 days ago
On 3/20/26 17:15, Claudio Imbrenda wrote:
> In most cases gmap_put() was not called when it should have.
> 
> Add the missing gmap_put() in vsie_run().
> 
> Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
> Fixes: e38c884df921 ("KVM: s390: Switch to new gmap")


Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Re: [PATCH v2 5/8] KVM: s390: vsie: Fix refcount overflow for shadow gmaps
Posted by Steffen Eiden 1 week, 4 days ago
On Fri, Mar 20, 2026 at 05:15:39PM +0100, Claudio Imbrenda wrote:
> In most cases gmap_put() was not called when it should have.
> 
> Add the missing gmap_put() in vsie_run().
> 
> Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
> Fixes: e38c884df921 ("KVM: s390: Switch to new gmap")

Reviewed-by: Steffen Eiden <seiden@linux.ibm.com>