Commit 0aba2a81 authored by David Hildenbrand's avatar David Hildenbrand Committed by Luis Henriques

KVM: s390: avoid memory leaks if __inject_vm() fails

commit 428d53be upstream.

We have to delete the allocated interrupt info if __inject_vm() fails.

Otherwise user space can keep flooding kvm with floating interrupts and
provoke more and more memory leaks.
Reported-by: default avatarDominik Dingel <dingel@linux.vnet.ibm.com>
Reviewed-by: default avatarDominik Dingel <dingel@linux.vnet.ibm.com>
Signed-off-by: default avatarDavid Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent 36c99ba9
......@@ -951,6 +951,7 @@ int kvm_s390_inject_vm(struct kvm *kvm,
struct kvm_s390_interrupt *s390int)
{
struct kvm_s390_interrupt_info *inti;
int rc;
inti = kzalloc(sizeof(*inti), GFP_KERNEL);
if (!inti)
......@@ -998,7 +999,10 @@ int kvm_s390_inject_vm(struct kvm *kvm,
trace_kvm_s390_inject_vm(s390int->type, s390int->parm, s390int->parm64,
2);
return __inject_vm(kvm, inti);
rc = __inject_vm(kvm, inti);
if (rc)
kfree(inti);
return rc;
}
void kvm_s390_reinject_io_int(struct kvm *kvm,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment