All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lib/copperplate: Also deregister main thread from registry sysgroup
@ 2023-03-22  5:48 Jan Kiszka
  0 siblings, 0 replies; only message in thread
From: Jan Kiszka @ 2023-03-22  5:48 UTC (permalink / raw)
  To: Xenomai; +Cc: Mauro Salvini

From: Jan Kiszka <jan.kiszka@siemens.com>

Before 6b4337fed433, we were leaking the object so that the forgotten
deregistration caused no major harm. Now that we delete it, it's easy to
crash on later accesses to the thread sysgroup.

Reported-by: Mauro Salvini <mau.salvi@yahoo.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 lib/copperplate/threadobj.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/copperplate/threadobj.c b/lib/copperplate/threadobj.c
index 6808bcf164..db18f4ffa3 100644
--- a/lib/copperplate/threadobj.c
+++ b/lib/copperplate/threadobj.c
@@ -1773,7 +1773,10 @@ int threadobj_set_schedprio(struct threadobj *thobj, int priority)
 #ifdef CONFIG_XENO_PSHARED
 static void main_exit(void)
 {
-	threadobj_free(threadobj_current());
+	struct threadobj *thobj = threadobj_current();
+
+	sysgroup_remove(thread, &thobj->memspec);
+	threadobj_free(thobj);
 }
 #endif
 
-- 
2.35.3

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-22  5:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-22  5:48 [PATCH] lib/copperplate: Also deregister main thread from registry sysgroup Jan Kiszka

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.