mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-27 22:13:55 -04:00
powerpc/xive: defer setting cause_ipi until IPI init succeeds
xive_smp_probe() currently assigns smp_ops->cause_ipi = xive_cause_ipi before calling xive_init_ipis() and xive_setup_cpu_ipi(). If either call fails, the platform probe handler returns early but cause_ipi remains pointing to xive_cause_ipi -- which accesses per-cpu IPI data (xc->ipi_data) that was never properly initialized, leading to a WARN and a crash. Move the cause_ipi assignment to after both calls succeed, so that smp_ops->cause_ipi is only set when the IPI subsystem is fully initialized. Signed-off-by: Gou Hao <gouhao@uniontech.com> Suggested-by: Cédric Le Goater <clg@kaod.org> Reviewed-by: jiazhenyuan <jiazhenyuan@uniontech.com> Reviewed-by: Cédric Le Goater <clg@kaod.org> Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com> Link: https://patch.msgid.link/20260727104215.184786-5-gouhao@uniontech.com
This commit is contained in:
committed by
Madhavan Srinivasan
parent
411a3c016e
commit
37d401c9c4
@@ -1269,15 +1269,19 @@ int __init xive_smp_probe(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
smp_ops->cause_ipi = xive_cause_ipi;
|
||||
|
||||
/* Register the IPI */
|
||||
ret = xive_init_ipis();
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* Allocate and setup IPI for the boot CPU */
|
||||
return xive_setup_cpu_ipi(smp_processor_id());
|
||||
ret = xive_setup_cpu_ipi(smp_processor_id());
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
smp_ops->cause_ipi = xive_cause_ipi;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_SMP */
|
||||
|
||||
Reference in New Issue
Block a user