path: root/virt
diff options
authorZhu Lingshan <>2021-05-08 15:11:52 +0800
committerMarc Zyngier <>2021-05-15 10:26:55 +0100
commite44b49f623c77bee7451f1a82ccfb969c1028ae2 (patch)
tree6b5aef3e09c0e79ce5a53f488a02ae1ee7f155f9 /virt
parent6efb943b8616ec53a5e444193dccf1af9ad627b5 (diff)
Revert "irqbypass: do not start cons/prod when failed connect"
This reverts commit a979a6aa009f3c99689432e0cdb5402a4463fb88. The reverted commit may cause VM freeze on arm64 with GICv4, where stopping a consumer is implemented by suspending the VM. Should the connect fail, the VM will not be resumed, which is a bit of a problem. It also erroneously calls the producer destructor unconditionally, which is unexpected. Reported-by: Shaokun Zhang <> Suggested-by: Marc Zyngier <> Acked-by: Jason Wang <> Acked-by: Michael S. Tsirkin <> Reviewed-by: Eric Auger <> Tested-by: Shaokun Zhang <> Signed-off-by: Zhu Lingshan <> [maz: tags and cc-stable, commit message update] Signed-off-by: Marc Zyngier <> Fixes: a979a6aa009f ("irqbypass: do not start cons/prod when failed connect") Link: Link: Cc:
Diffstat (limited to 'virt')
1 files changed, 6 insertions, 10 deletions
diff --git a/virt/lib/irqbypass.c b/virt/lib/irqbypass.c
index c9bb3957f58a..28fda42e471b 100644
--- a/virt/lib/irqbypass.c
+++ b/virt/lib/irqbypass.c
@@ -40,21 +40,17 @@ static int __connect(struct irq_bypass_producer *prod,
if (prod->add_consumer)
ret = prod->add_consumer(prod, cons);
- if (ret)
- goto err_add_consumer;
- ret = cons->add_producer(cons, prod);
- if (ret)
- goto err_add_producer;
+ if (!ret) {
+ ret = cons->add_producer(cons, prod);
+ if (ret && prod->del_consumer)
+ prod->del_consumer(prod, cons);
+ }
if (cons->start)
if (prod->start)
- if (prod->del_consumer)
- prod->del_consumer(prod, cons);
return ret;