This is a note to let you know that I've just added the patch titled KVM: arm64: Fix buffer overflow in kvm_arm_set_fw_reg() to the 5.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: kvm-arm64-fix-buffer-overflow-in-kvm_arm_set_fw_reg.patch and it can be found in the queue-5.15 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From a25bc8486f9c01c1af6b6c5657234b2eee2c39d6 Mon Sep 17 00:00:00 2001 From: Dan Carpenter <dan.carpenter@xxxxxxxxxx> Date: Wed, 19 Apr 2023 13:16:13 +0300 Subject: KVM: arm64: Fix buffer overflow in kvm_arm_set_fw_reg() From: Dan Carpenter <dan.carpenter@xxxxxxxxxx> commit a25bc8486f9c01c1af6b6c5657234b2eee2c39d6 upstream. The KVM_REG_SIZE() comes from the ioctl and it can be a power of two between 0-32768 but if it is more than sizeof(long) this will corrupt memory. Fixes: 99adb567632b ("KVM: arm/arm64: Add save/restore support for firmware workaround state") Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> Reviewed-by: Steven Price <steven.price@xxxxxxx> Reviewed-by: Eric Auger <eric.auger@xxxxxxxxxx> Reviewed-by: Marc Zyngier <maz@xxxxxxxxxx> Link: https://lore.kernel.org/r/4efbab8c-640f-43b2-8ac6-6d68e08280fe@kili.mountain Signed-off-by: Oliver Upton <oliver.upton@xxxxxxxxx> [will: kvm_arm_set_fw_reg() lives in psci.c not hypercalls.c] Signed-off-by: Will Deacon <will@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- arch/arm64/kvm/psci.c | 2 ++ 1 file changed, 2 insertions(+) --- a/arch/arm64/kvm/psci.c +++ b/arch/arm64/kvm/psci.c @@ -508,6 +508,8 @@ int kvm_arm_set_fw_reg(struct kvm_vcpu * u64 val; int wa_level; + if (KVM_REG_SIZE(reg->id) != sizeof(val)) + return -ENOENT; if (copy_from_user(&val, uaddr, KVM_REG_SIZE(reg->id))) return -EFAULT; Patches currently in stable-queue which might be from dan.carpenter@xxxxxxxxxx are queue-5.15/kvm-arm64-fix-buffer-overflow-in-kvm_arm_set_fw_reg.patch