sched_smp:adjust the unlock order
1.nxsem_post wake up nxsched_smp_call; 2.stack smp_call_data_s may return; 3.nxsched_smp_call_handler access call_data->lock is not safety; so adjust the unlock order Signed-off-by: dulibo1 <dulibo1@xiaomi.com>
This commit is contained in:
parent
323b6bdea9
commit
1d135dbfd9
|
@ -137,6 +137,14 @@ int nxsched_smp_call_handler(int irq, FAR void *context,
|
|||
ret = call_data->func(call_data->arg);
|
||||
|
||||
flags = enter_critical_section();
|
||||
if (spin_is_locked(&call_data->lock))
|
||||
{
|
||||
if (--call_data->refcount == 0)
|
||||
{
|
||||
spin_unlock(&call_data->lock);
|
||||
}
|
||||
}
|
||||
|
||||
if (call_data->cookie != NULL)
|
||||
{
|
||||
if (ret < 0)
|
||||
|
@ -146,14 +154,6 @@ int nxsched_smp_call_handler(int irq, FAR void *context,
|
|||
|
||||
nxsem_post(&call_data->cookie->sem);
|
||||
}
|
||||
|
||||
if (spin_is_locked(&call_data->lock))
|
||||
{
|
||||
if (--call_data->refcount == 0)
|
||||
{
|
||||
spin_unlock(&call_data->lock);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
up_cpu_paused_restore();
|
||||
|
|
Loading…
Reference in New Issue