summaryrefslogtreecommitdiff
path: root/virt
diff options
context:
space:
mode:
authorMichal Luczaj <mhal@rbox.co>2023-03-27 20:54:57 +0300
committerSean Christopherson <seanjc@google.com>2023-06-01 23:48:54 +0300
commit70b0bc4c0a05cb68ffeeaba8c8340896b5ff6fd7 (patch)
treed74308c62abb8ebd350bdf2aca9236236ac614ef /virt
parentc9d601548603c54919a3b1333c5b972252b4031d (diff)
downloadlinux-70b0bc4c0a05cb68ffeeaba8c8340896b5ff6fd7.tar.xz
KVM: Don't kfree(NULL) on kzalloc() failure in kvm_assign_ioeventfd_idx()
On kzalloc() failure, taking the `goto fail` path leads to kfree(NULL). Such no-op has no use. Move it out. Signed-off-by: Michal Luczaj <mhal@rbox.co> Reviewed-by: Sean Christopherson <seanjc@google.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Link: https://lore.kernel.org/r/20230327175457.735903-1-mhal@rbox.co Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/eventfd.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
index b0af834ffa95..7c42441425cf 100644
--- a/virt/kvm/eventfd.c
+++ b/virt/kvm/eventfd.c
@@ -889,9 +889,9 @@ static int kvm_assign_ioeventfd_idx(struct kvm *kvm,
unlock_fail:
mutex_unlock(&kvm->slots_lock);
+ kfree(p);
fail:
- kfree(p);
eventfd_ctx_put(eventfd);
return ret;