summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQiang Ma <maqianga@uniontech.com>2026-06-11 15:46:43 +0300
committerHuacai Chen <chenhuacai@loongson.cn>2026-06-11 15:46:43 +0300
commitfb89e0fe2dc4246c86ad0eb0fa2b7cb2f8ba9728 (patch)
tree19758ed14fc2e6854d5ea7854c3eacc4b4e64fc0
parent83551ccedffda28b1fa7aeb8fcf5e00489443816 (diff)
downloadlinux-fb89e0fe2dc4246c86ad0eb0fa2b7cb2f8ba9728.tar.xz
LoongArch: KVM: Check the return values for put_user()
put_user() may return -EFAULT, so, when the user space address is invalid, the caller should return -EFAULT. Cc: stable@vger.kernel.org Reviewed-by: Bibo Mao <maobibo@loongson.cn> Signed-off-by: Qiang Ma <maqianga@uniontech.com> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
-rw-r--r--arch/loongarch/kvm/vcpu.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/loongarch/kvm/vcpu.c b/arch/loongarch/kvm/vcpu.c
index 33aefd90d228..20c207d80e31 100644
--- a/arch/loongarch/kvm/vcpu.c
+++ b/arch/loongarch/kvm/vcpu.c
@@ -1106,7 +1106,8 @@ static int kvm_loongarch_cpucfg_get_attr(struct kvm_vcpu *vcpu,
return -ENXIO;
}
- put_user(val, uaddr);
+ if (put_user(val, uaddr))
+ return -EFAULT;
return ret;
}