FAILED: patch "[PATCH] KVM: arm64: Fix buffer overflow in kvm_arm_set_fw_reg()" failed to apply to 5.10-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x a25bc8486f9c01c1af6b6c5657234b2eee2c39d6
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2023042350-coveted-collapse-44f5@gregkh' --subject-prefix 'PATCH 5.10.y' HEAD^..
Possible dependencies:
a25bc8486f9c ("KVM: arm64: Fix buffer overflow in kvm_arm_set_fw_reg()") 85fbe08e4da8 ("KVM: arm64: Factor out firmware register handling from psci.c") 1ebdbeb03efe ("Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From a25bc8486f9c01c1af6b6c5657234b2eee2c39d6 Mon Sep 17 00:00:00 2001
From: Dan Carpenter <[email protected]>
Date: Wed, 19 Apr 2023 13:16:13 +0300
Subject: [PATCH] KVM: arm64: Fix buffer overflow in kvm_arm_set_fw_reg()
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.
arch/arm64/kvm/hypercalls.c +2 -0
@@ -397,6 +397,8 @@ int kvm_arm_set_fw_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)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 ;