[PATCH] KVM: x86/xen: Fix eventfd error handling in kvm_xen_eventfd_assign()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Should not call eventfd_ctx_put() in case of error.

Fixes: 2fd6df2f2b47 ("KVM: x86/xen: intercept EVTCHNOP_send from guests")
Reported-by: syzbot+6f0c896c5a9449a10ded@xxxxxxxxxxxxxxxxxxxxxxxxx
Signed-off-by: Eiichi Tsukata <eiichi.tsukata@xxxxxxxxxxx>
---
 arch/x86/kvm/xen.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kvm/xen.c b/arch/x86/kvm/xen.c
index 93c628d3e3a9..a357994982c6 100644
--- a/arch/x86/kvm/xen.c
+++ b/arch/x86/kvm/xen.c
@@ -1716,7 +1716,7 @@ static int kvm_xen_eventfd_assign(struct kvm *kvm,
 	if (ret == -ENOSPC)
 		ret = -EEXIST;
 out:
-	if (eventfd)
+	if (eventfd && !IS_ERR(eventfd))
 		eventfd_ctx_put(eventfd);
 	kfree(evtchnfd);
 	return ret;
-- 
2.37.3




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux