group_leave: Don't instantiate address environment prior to destroying it

This is just unnecessary, a process cannot be destroyed by another
process in any case, every time this is executed the active address
environment is the process getting destroyed.

Even in the hypothetical case this was possible, the system would
crash at once if a context switch happens between "select()" and
"restore()", which is possible as the granule allocator is protected by
a semaphore (which is a synchronization point).
This commit is contained in:
Ville Juven 2023-01-17 16:20:19 +02:00 committed by Xiang Xiao
parent b3360e4da9
commit 6a026382f0

View File

@ -129,7 +129,6 @@ static void group_remove(FAR struct task_group_s *group)
static inline void group_release(FAR struct task_group_s *group)
{
#ifdef CONFIG_ARCH_ADDRENV
save_addrenv_t oldenv;
int i;
#endif
@ -203,10 +202,6 @@ static inline void group_release(FAR struct task_group_s *group)
#endif
#ifdef CONFIG_ARCH_ADDRENV
/* Switch the addrenv and also save the current addrenv */
up_addrenv_select(&group->tg_addrenv, &oldenv);
/* Destroy the group address environment */
up_addrenv_destroy(&group->tg_addrenv);
@ -220,10 +215,6 @@ static inline void group_release(FAR struct task_group_s *group)
g_group_current[i] = NULL;
}
}
/* Restore the previous addrenv */
up_addrenv_restore(&oldenv);
#endif
#if defined(CONFIG_SCHED_WAITPID) && !defined(CONFIG_SCHED_HAVE_PARENT)