aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kvm/interrupt.c
diff options
context:
space:
mode:
authorDavid Hildenbrand <dahi@linux.vnet.ibm.com>2015-01-16 06:58:09 -0500
committerChristian Borntraeger <borntraeger@de.ibm.com>2015-01-23 07:25:41 -0500
commit428d53be5e7468769d4e7899cca06ed5f783a6e1 (patch)
treee6b2653336d25b0532732e4b75aab908862090c0 /arch/s390/kvm/interrupt.c
parenta374e892c3421f81a71e85d5a8c526959221f279 (diff)
KVM: s390: avoid memory leaks if __inject_vm() fails
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: Dominik Dingel <dingel@linux.vnet.ibm.com> Reviewed-by: Dominik Dingel <dingel@linux.vnet.ibm.com> Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Cc: stable@vger.kernel.org # v3.15+ Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Diffstat (limited to 'arch/s390/kvm/interrupt.c')
-rw-r--r--arch/s390/kvm/interrupt.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
index a6cb238049d1..6d7513e15560 100644
--- a/arch/s390/kvm/interrupt.c
+++ b/arch/s390/kvm/interrupt.c
@@ -1277,6 +1277,7 @@ int kvm_s390_inject_vm(struct kvm *kvm,
1277 struct kvm_s390_interrupt *s390int) 1277 struct kvm_s390_interrupt *s390int)
1278{ 1278{
1279 struct kvm_s390_interrupt_info *inti; 1279 struct kvm_s390_interrupt_info *inti;
1280 int rc;
1280 1281
1281 inti = kzalloc(sizeof(*inti), GFP_KERNEL); 1282 inti = kzalloc(sizeof(*inti), GFP_KERNEL);
1282 if (!inti) 1283 if (!inti)
@@ -1324,7 +1325,10 @@ int kvm_s390_inject_vm(struct kvm *kvm,
1324 trace_kvm_s390_inject_vm(s390int->type, s390int->parm, s390int->parm64, 1325 trace_kvm_s390_inject_vm(s390int->type, s390int->parm, s390int->parm64,
1325 2); 1326 2);
1326 1327
1327 return __inject_vm(kvm, inti); 1328 rc = __inject_vm(kvm, inti);
1329 if (rc)
1330 kfree(inti);
1331 return rc;
1328} 1332}
1329 1333
1330void kvm_s390_reinject_io_int(struct kvm *kvm, 1334void kvm_s390_reinject_io_int(struct kvm *kvm,