From: Josh Triplett <josh@joshtriplett.org>
To: kvm@vger.kernel.org
Cc: Will Deacon <will.deacon@arm.com>
Subject: [PATCH kvmtool] kvm__emulate_io: Don't fall through from IO in to IO out if no handler
Date: Thu, 6 Aug 2015 11:39:59 -0700 [thread overview]
Message-ID: <20150806183959.GA6740@cloud> (raw)
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@joshtriplett.org>
---
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
reply other threads:[~2015-08-06 18:40 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150806183959.GA6740@cloud \
--to=josh@joshtriplett.org \
--cc=kvm@vger.kernel.org \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.