Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1473711 > unrolled thread
| Started by | Luiz Capitulino <lcapitulino@redhat.com> |
|---|---|
| First post | 2016-08-31 19:10 +0200 |
| Last post | 2016-08-31 19:10 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 2/4] kvm: kvm_create_vm_debugfs(): cleanup on error Luiz Capitulino <lcapitulino@redhat.com> - 2016-08-31 19:10 +0200
| From | Luiz Capitulino <lcapitulino@redhat.com> |
|---|---|
| Date | 2016-08-31 19:10 +0200 |
| Subject | [PATCH 2/4] kvm: kvm_create_vm_debugfs(): cleanup on error |
| Message-ID | <schbr-59T-7@gated-at.bofh.it> |
Memory and debugfs entries are leaked on error. Fix it.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
virt/kvm/kvm_main.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index c1dc45e..9293285 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -585,12 +585,12 @@ static int kvm_create_vm_debugfs(struct kvm *kvm, int fd)
sizeof(*kvm->debugfs_stat_data),
GFP_KERNEL);
if (!kvm->debugfs_stat_data)
- return -ENOMEM;
+ goto out_err;
for (p = debugfs_entries; p->name; p++) {
stat_data = kzalloc(sizeof(*stat_data), GFP_KERNEL);
if (!stat_data)
- return -ENOMEM;
+ goto out_err;
stat_data->kvm = kvm;
stat_data->offset = p->offset;
@@ -599,9 +599,13 @@ static int kvm_create_vm_debugfs(struct kvm *kvm, int fd)
kvm->debugfs_dentry,
stat_data,
stat_fops_per_vm[p->kind]))
- return -ENOMEM;
+ goto out_err;
}
return 0;
+
+out_err:
+ kvm_destroy_vm_debugfs(kvm);
+ return -ENOMEM;
}
static struct kvm *kvm_create_vm(unsigned long type)
--
2.5.5
Back to top | Article view | linux.kernel
csiph-web