From: Jean-Philippe Brucker <jean-philippe.brucker@xxxxxxx> 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@xxxxxxx> Signed-off-by: Julien Thierry <julien.thierry@xxxxxxx> --- ioeventfd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ioeventfd.c b/ioeventfd.c index 14453b8..3ae8267 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, -- 1.9.1