mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
LoongArch: KVM: Check irq validity in kvm_vcpu_ioctl_interrupt()
Function kvm_vcpu_ioctl_interrupt() can be called from userspace, here
add irq validility cheking in kvm_vcpu_ioctl_interrupt().
Cc: stable@vger.kernel.org
Fixes: f45ad5b8aa ("LoongArch: KVM: Implement vcpu interrupt operations")
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
This commit is contained in:
parent
1ef045effb
commit
09b318ab77
|
|
@ -1452,6 +1452,10 @@ void kvm_lose_fpu(struct kvm_vcpu *vcpu)
|
|||
int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu, struct kvm_interrupt *irq)
|
||||
{
|
||||
int intr = (int)irq->irq;
|
||||
unsigned int vector = abs(intr);
|
||||
|
||||
if (vector >= EXCCODE_INT_NUM)
|
||||
return -EINVAL;
|
||||
|
||||
if (intr > 0)
|
||||
kvm_queue_irq(vcpu, intr);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user