]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
KVM: s390: vsie: Fix race in walk_guest_tables()
authorClaudio Imbrenda <imbrenda@linux.ibm.com>
Fri, 6 Feb 2026 14:35:52 +0000 (15:35 +0100)
committerClaudio Imbrenda <imbrenda@linux.ibm.com>
Tue, 10 Feb 2026 10:33:30 +0000 (11:33 +0100)
It is possible that walk_guest_tables() is called on a shadow gmap that
has been removed already, in which case its parent will be NULL.

In such case, return -EAGAIN and let the callers deal with it.

Fixes: e38c884df921 ("KVM: s390: Switch to new gmap")
Acked-by: Janosch Frank <frankja@linux.ibm.com>
Reviewed-by: Christoph Schlameuss <schlameuss@linux.ibm.com>
Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
arch/s390/kvm/gaccess.c

index 67de47a81a8747ba6673bd2ec54ff2de882c2a25..4630b2a067ea61a299a3e41271cbf4bf33d90935 100644 (file)
@@ -1287,7 +1287,10 @@ static int walk_guest_tables(struct gmap *sg, unsigned long saddr, struct pgtwal
        union asce asce;
        int rc;
 
+       if (!parent)
+               return -EAGAIN;
        kvm = parent->kvm;
+       WARN_ON(!kvm);
        asce = sg->guest_asce;
        entries = get_entries(w);