diff options
author | Jean-Philippe Brucker <jean-philippe.brucker@arm.com> | 2019-01-10 14:12:38 +0000 |
---|---|---|
committer | Will Deacon <will.deacon@arm.com> | 2019-01-22 06:55:26 +0000 |
commit | 56c82a0305d7f889a05c71fd11bff4c6609c5199 (patch) | |
tree | 4dfc87ce5e400d8bd415b601f85f8caa5dcfe003 | |
parent | 9afefd6c79015480366e42eb7faa60f72d5984ae (diff) | |
download | kvmtool-56c82a0305d7f889a05c71fd11bff4c6609c5199.tar.gz |
ioeventfd: Fix removal of ioeventfd
Fix three bugs that prevent removal of ioeventfds in KVM. Store the
flags in the right structure, check the datamatch parameter, and pass
the fd to KVM.
Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
Signed-off-by: Julien Thierry <julien.thierry@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
-rw-r--r-- | ioeventfd.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/ioeventfd.c b/ioeventfd.c index 14453b82..3ae82672 100644 --- a/ioeventfd.c +++ b/ioeventfd.c @@ -172,7 +172,7 @@ int ioeventfd__add_event(struct ioevent *ioevent, int flags) } } - ioevent->flags = kvm_ioevent.flags; + new_ioevent->flags = kvm_ioevent.flags; list_add_tail(&new_ioevent->list, &used_ioevents); return 0; @@ -192,7 +192,8 @@ int ioeventfd__del_event(u64 addr, u64 datamatch) return -ENOSYS; list_for_each_entry(ioevent, &used_ioevents, list) { - if (ioevent->io_addr == addr) { + if (ioevent->io_addr == addr && + ioevent->datamatch == datamatch) { found = 1; break; } @@ -202,6 +203,7 @@ int ioeventfd__del_event(u64 addr, u64 datamatch) return -ENOENT; kvm_ioevent = (struct kvm_ioeventfd) { + .fd = ioevent->fd, .addr = ioevent->io_addr, .len = ioevent->io_len, .datamatch = ioevent->datamatch, |