Skip to content

Commit

Permalink
binfmt/execmodule: correct destroy flow
Browse files Browse the repository at this point in the history
1. stack_alloc_ptr should be freed in kernel mode
2. replace nxsched_release_tcb() to nxtask_uninit() to remove tcb from inactive list

Signed-off-by: chao an <anchao@xiaomi.com>
  • Loading branch information
anchao authored and xiaoxiang781216 committed Apr 26, 2023
1 parent 64b948c commit e3ca288
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions binfmt/binfmt_execmodule.c
Expand Up @@ -285,8 +285,14 @@ int exec_module(FAR struct binary_s *binp,

#if defined(CONFIG_ARCH_ADDRENV) || defined(CONFIG_ARCH_VMA_MAPPING)
errout_with_tcbinit:
tcb->cmn.stack_alloc_ptr = NULL;
nxsched_release_tcb(&tcb->cmn, TCB_FLAG_TTYPE_TASK);
#ifndef CONFIG_BUILD_KERNEL
if (binp->stackaddr != NULL)
{
tcb->cmn.stack_alloc_ptr = NULL;
}
#endif

nxtask_uninit(tcb);
return ret;
#endif

Expand Down

0 comments on commit e3ca288

Please sign in to comment.