setup_interrupt() can fail and report via errp, but
process_msg_connect() was ignoring the error and continuing
to ivshmem_add_eventfd(). Add ERRP_GUARD() and check *errp
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 | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/hw/misc/ivshmem-pci.c b/hw/misc/ivshmem-pci.c
index 45b0e20363..85614feca0 100644
--- a/hw/misc/ivshmem-pci.c
+++ b/hw/misc/ivshmem-pci.c
@@ -528,6 +528,7 @@ static void process_msg_disconnect(IVShmemState *s, uint16_t posn,
static void process_msg_connect(IVShmemState *s, uint16_t posn, int fd,
Error **errp)
{
+ ERRP_GUARD();
Peer *peer = &s->peers[posn];
int vector;
@@ -554,7 +555,9 @@ 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 (*errp) {
+ return;
+ }
}
if (ivshmem_has_feature(s, IVSHMEM_IOEVENTFD)) {
--
2.50.1 (Apple Git-155)