platform: be robust on IRQ creation failure

In case invalid IRQ numbers are used (255 on x86), the IRQ session creation
request may be denied and the platform driver is killed because of the
uncatched exception, which must be avoided.

Issue #5406
This commit is contained in:
Alexander Boettcher 2025-01-15 11:16:55 +01:00 committed by Christian Helmuth
parent 91a58d3e98
commit 9239b36f05

View File

@ -152,6 +152,7 @@ Genode::Irq_session_capability Device_component::irq(unsigned idx)
return remapped_irq;
};
try {
_irq_registry.for_each([&] (Irq & irq)
{
if (irq.idx != idx)
@ -210,6 +211,7 @@ Genode::Irq_session_capability Device_component::irq(unsigned idx)
cap = irq.shared ? irq.sirq->cap() : irq.irq->cap();
});
} catch (Service_denied) { error("irq could not be setup ", _device); }
return cap;
}