During core scheduler initialization, each registered scheduler
is sanity tested in two steps:
- it must provide required callbacks (e.g. init, do_schedule).
- if global_init callback is present, it must succeed.
If any of the steps fail, scheduler entry is cleared in global
'schedulers' array.
However, in the current implementation, if verification fails during
the first step, the scheduler entry is cleared but verification
sequence is not interrupted. This lead to NULL pointer dereference
when subsequent required callbacks verified, and possible during
the second step.
The patch fixes the crashes by skipping consequent checks if one of
the required callbacks are not present for the scheduler.
Fixes: ec25b3c026 ("xen/sched: only allow schedulers with all mandatory functions available")
Signed-off-by: Ruslan Ruslichenko <Ruslan_Ruslichenko@epam.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Juergen Gross <jgross@suse.com>