[PATCH kvmtool] kvm__emulate_io: Don't fall through from IO in to IO out if no handler

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

 



If an IO port device has no io_in handler, kvm__emulate_io would fall
through and call the io_out handler instead.  Fix to only call the
handler for the appropriate direction.

If no handler exists, kvm__emulate_io will automatically treat it as an
IO error (due to the default "ret = false").

Signed-off-by: Josh Triplett <josh@xxxxxxxxxxxxxxxx>
---
 ioport.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ioport.c b/ioport.c
index 8c55a84..263fe50 100644
--- a/ioport.c
+++ b/ioport.c
@@ -192,7 +192,7 @@ bool kvm__emulate_io(struct kvm_cpu *vcpu, u16 port, void *data, int direction,
 	while (count--) {
 		if (direction == KVM_EXIT_IO_IN && ops->io_in)
 				ret = ops->io_in(entry, vcpu, port, ptr, size);
-		else if (ops->io_out)
+		else if (direction == KVM_EXIT_IO_OUT && ops->io_out)
 				ret = ops->io_out(entry, vcpu, port, ptr, size);
 
 		ptr += size;
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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