setup_interrupt() can fail and report via errp, but
process_msg_connect() was ignoring the error and continuing
to ivshmem_add_eventfd(). Check the bool return to avoid
operating on a vector whose interrupt setup failed.
Resolves the TODO comment at the call site.
Signed-off-by: David Hamilton <dahamilt0@gmail.com>
---
hw/misc/ivshmem-pci.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/hw/misc/ivshmem-pci.c b/hw/misc/ivshmem-pci.c
index c987eebb98..147e8223bb 100644
--- a/hw/misc/ivshmem-pci.c
+++ b/hw/misc/ivshmem-pci.c
@@ -553,8 +553,10 @@ static void process_msg_connect(IVShmemState *s, uint16_t posn, int fd,
}
if (posn == s->vm_id) {
- setup_interrupt(s, vector, errp);
- /* TODO do we need to handle the error? */
+ if (!setup_interrupt(s, vector, errp)) {
+ close(fd);
+ return;
+ }
}
if (ivshmem_has_feature(s, IVSHMEM_IOEVENTFD)) {
--
2.50.1 (Apple Git-155)