diff options
author | David S. Miller <davem@davemloft.net> | 2015-07-10 00:05:33 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-07-10 00:05:33 +0200 |
commit | fc5778ca3f3c57af53f0c6b6912970f6416a3a5f (patch) | |
tree | 8311322efb11300bcbbeefee9d3a711508b6c56c | |
parent | cdc_ncm: Add support for moving NDP to end of NCM frame (diff) | |
parent | net: pktgen: kill the "Wait for kthread_stop" code in pktgen_thread_worker() (diff) | |
download | linux-fc5778ca3f3c57af53f0c6b6912970f6416a3a5f.tar.xz linux-fc5778ca3f3c57af53f0c6b6912970f6416a3a5f.zip |
Merge branch 'pktgen-races'
Oleg Nesterov says:
====================
net: pktgen: fix race between pktgen_thread_worker() and kthread_stop()
I am not familiar with this code and I have no idea how to test
these changes, so 2/2 comes as a separate change. 1/2 looks like
the obvious bugfix, and probably candidate for -stable.
====================
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/core/pktgen.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/net/core/pktgen.c b/net/core/pktgen.c index 05badbb58865..1ebdf1c0d118 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c @@ -3571,13 +3571,6 @@ static int pktgen_thread_worker(void *arg) pr_debug("%s removing thread\n", t->tsk->comm); pktgen_rem_thread(t); - /* Wait for kthread_stop */ - while (!kthread_should_stop()) { - set_current_state(TASK_INTERRUPTIBLE); - schedule(); - } - __set_current_state(TASK_RUNNING); - return 0; } @@ -3769,6 +3762,7 @@ static int __net_init pktgen_create_thread(int cpu, struct pktgen_net *pn) } t->net = pn; + get_task_struct(p); wake_up_process(p); wait_for_completion(&t->start_done); @@ -3891,6 +3885,7 @@ static void __net_exit pg_net_exit(struct net *net) t = list_entry(q, struct pktgen_thread, th_list); list_del(&t->th_list); kthread_stop(t->tsk); + put_task_struct(t->tsk); kfree(t); } |