lkml.org 
[lkml]   [2020]   [Apr]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] kernel/trace: Stop and wait for kthread on preempt irq module unload
Date
Kthread running the test needs to be stopped or it can continue
executing code unloaded by module causing a crash.

Suggested-by: Steven Rostedt <rostedt@goodmis.org>
Reported-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
Link: http://lore.kernel.org/r/5EA2B0C8.2080706@cn.fujitsu.com
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
---
kernel/trace/preemptirq_delay_test.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/trace/preemptirq_delay_test.c b/kernel/trace/preemptirq_delay_test.c
index 31c0fad4cb9e1..1c28ca20e30b6 100644
--- a/kernel/trace/preemptirq_delay_test.c
+++ b/kernel/trace/preemptirq_delay_test.c
@@ -145,10 +145,10 @@ static struct attribute_group attr_group = {
};

static struct kobject *preemptirq_delay_kobj;
+static struct task_struct *test_task;

static int __init preemptirq_delay_init(void)
{
- struct task_struct *test_task;
int retval;

test_task = preemptirq_start_test();
@@ -171,6 +171,9 @@ static int __init preemptirq_delay_init(void)
static void __exit preemptirq_delay_exit(void)
{
kobject_put(preemptirq_delay_kobj);
+
+ if (test_task)
+ kthread_stop(test_task);
}

module_init(preemptirq_delay_init)
--
2.26.2.303.gf8c07b1a785-goog
\
 
 \ /
  Last update: 2020-04-25 00:37    [W:0.075 / U:0.496 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site