KVM: s390: Fix potential tiny kernel stack leak

In some circumstances, one bit of kernel stack could have been leaked
from dat_cond_set_storage_key().

Fix by clearing prev before use.

Fixes: 8e03e8316e ("KVM: s390: KVM page table management functions: storage keys")
Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Message-ID: <20260812104436.109741-9-imbrenda@linux.ibm.com>
This commit is contained in:
Claudio Imbrenda 2026-08-12 12:44:35 +02:00
parent 6b1130e1b4
commit 30300ec278

View File

@ -737,6 +737,7 @@ int dat_cond_set_storage_key(struct kvm_s390_mmu_cache *mmc, union asce asce, gf
pgste.fp = skey.fp;
pgste.gc = skey.c;
pgste.gr = skey.r;
prev.skey = 0;
if (!ptep->h.i) {
rc = page_cond_set_storage_key(pte_origin(*ptep), skey, &prev, nq, mr, mc);