Skip to content

Commit e44b49f

Browse files
Zhu LingshanMarc Zyngier
authored andcommitted
Revert "irqbypass: do not start cons/prod when failed connect"
This reverts commit a979a6a. 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 <[email protected]> Suggested-by: Marc Zyngier <[email protected]> Acked-by: Jason Wang <[email protected]> Acked-by: Michael S. Tsirkin <[email protected]> Reviewed-by: Eric Auger <[email protected]> Tested-by: Shaokun Zhang <[email protected]> Signed-off-by: Zhu Lingshan <[email protected]> [maz: tags and cc-stable, commit message update] Signed-off-by: Marc Zyngier <[email protected]> Fixes: a979a6a ("irqbypass: do not start cons/prod when failed connect") Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected] Cc: [email protected]
1 parent 6efb943 commit e44b49f

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

virt/lib/irqbypass.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,21 +40,17 @@ static int __connect(struct irq_bypass_producer *prod,
4040
if (prod->add_consumer)
4141
ret = prod->add_consumer(prod, cons);
4242

43-
if (ret)
44-
goto err_add_consumer;
45-
46-
ret = cons->add_producer(cons, prod);
47-
if (ret)
48-
goto err_add_producer;
43+
if (!ret) {
44+
ret = cons->add_producer(cons, prod);
45+
if (ret && prod->del_consumer)
46+
prod->del_consumer(prod, cons);
47+
}
4948

5049
if (cons->start)
5150
cons->start(cons);
5251
if (prod->start)
5352
prod->start(prod);
54-
err_add_producer:
55-
if (prod->del_consumer)
56-
prod->del_consumer(prod, cons);
57-
err_add_consumer:
53+
5854
return ret;
5955
}
6056

0 commit comments

Comments
 (0)