Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1485045

[PATCH 3/6] kvm: kvm_destroy_vm_debugfs(): check debugfs_stat_data pointer

From Luiz Capitulino <lcapitulino@redhat.com>
Newsgroups linux.kernel
Subject [PATCH 3/6] kvm: kvm_destroy_vm_debugfs(): check debugfs_stat_data pointer
Date 2016-09-16 16:30 +0200
Message-ID <si2jo-5SZ-51@gated-at.bofh.it> (permalink)
References <si2jn-5SZ-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Otherwise, the kernel panics when kvm_create_vm_debugfs()
fails before assigning this pointer.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 virt/kvm/kvm_main.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 1950782..c1dc45e 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -559,9 +559,11 @@ static void kvm_destroy_vm_debugfs(struct kvm *kvm)
 
 	debugfs_remove_recursive(kvm->debugfs_dentry);
 
-	for (i = 0; i < kvm_debugfs_num_entries; i++)
-		kfree(kvm->debugfs_stat_data[i]);
-	kfree(kvm->debugfs_stat_data);
+	if (kvm->debugfs_stat_data) {
+		for (i = 0; i < kvm_debugfs_num_entries; i++)
+			kfree(kvm->debugfs_stat_data[i]);
+		kfree(kvm->debugfs_stat_data);
+	}
 }
 
 static int kvm_create_vm_debugfs(struct kvm *kvm, int fd)
-- 
2.5.5

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/6] kvm: x86: export TSC information to user-space Luiz Capitulino <lcapitulino@redhat.com> - 2016-09-16 16:30 +0200
  [PATCH 1/6] kvm: x86: add tsc_offset field to struct kvm_vcpu_arch Luiz Capitulino <lcapitulino@redhat.com> - 2016-09-16 16:30 +0200
  [PATCH 3/6] kvm: kvm_destroy_vm_debugfs(): check debugfs_stat_data pointer Luiz Capitulino <lcapitulino@redhat.com> - 2016-09-16 16:30 +0200
  [PATCH 4/6] kvm: add stubs for arch specific debugfs support Luiz Capitulino <lcapitulino@redhat.com> - 2016-09-16 16:30 +0200
  [PATCH 2/6] kvm: x86: drop read_tsc_offset() Luiz Capitulino <lcapitulino@redhat.com> - 2016-09-16 16:30 +0200
    Re: [PATCH 2/6] kvm: x86: drop read_tsc_offset() Paolo Bonzini <pbonzini@redhat.com> - 2016-09-19 17:40 +0200
      Re: [PATCH 2/6] kvm: x86: drop read_tsc_offset() Jim Mattson <jmattson@google.com> - 2016-09-20 00:20 +0200
        Re: [PATCH 2/6] kvm: x86: drop read_tsc_offset() Paolo Bonzini <pbonzini@redhat.com> - 2016-09-20 07:40 +0200
          Re: [PATCH 2/6] kvm: x86: drop read_tsc_offset() Paolo Bonzini <pbonzini@redhat.com> - 2016-09-21 17:30 +0200
            Re: [PATCH 2/6] kvm: x86: drop read_tsc_offset() Jim Mattson <jmattson@google.com> - 2016-09-21 17:40 +0200
          Re: [PATCH 2/6] kvm: x86: drop read_tsc_offset() Jim Mattson <jmattson@google.com> - 2016-09-21 17:30 +0200
    Re: [PATCH 2/6] kvm: x86: drop read_tsc_offset() Jim Mattson <jmattson@google.com> - 2016-09-19 17:40 +0200
  Re: [PATCH v2 0/6] kvm: x86: export TSC information to user-space Paolo Bonzini <pbonzini@redhat.com> - 2016-09-16 17:00 +0200
    Re: [PATCH v2 0/6] kvm: x86: export TSC information to user-space Luiz Capitulino <lcapitulino@redhat.com> - 2016-09-16 17:00 +0200
      Re: [PATCH v2 0/6] kvm: x86: export TSC information to user-space Paolo Bonzini <pbonzini@redhat.com> - 2016-09-16 17:10 +0200
        Re: [PATCH v2 0/6] kvm: x86: export TSC information to user-space Luiz Capitulino <lcapitulino@redhat.com> - 2016-09-16 17:20 +0200

csiph-web