Some use cases of get_global_virq_handler() didn't account for the
case of running without hardware domain.
Fix that by testing get_global_virq_handler() returning NULL where
needed (e.g. when directly dereferencing the result).
Fixes: 980822c5edd1 ("xen/events: allow setting of global virq handler only for unbound virqs")
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
{
old = global_virq_handlers[virq];
hdl = get_global_virq_handler(virq);
- if ( hdl != d )
+ if ( !hdl )
+ global_virq_handlers[virq] = d;
+ else if ( hdl != d )
{
read_lock(&hdl->event_lock);
struct domain *d;
d = get_global_virq_handler(VIRQ_DOM_EXC);
- if ( unlikely(!get_domain(d)) )
+ if ( unlikely(!d) || unlikely(!get_domain(d)) )
return NULL;
read_lock(&d->event_lock);
void unlock_dom_exc_handler(struct domain *d)
{
+ if ( likely(!d) )
+ return;
+
read_unlock(&d->event_lock);
put_domain(d);