This is a note to let you know that I've just added the patch titled net: pktgen: fix race between pktgen_thread_worker() and kthread_stop() to the 4.1-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: net-pktgen-fix-race-between-pktgen_thread_worker-and-kthread_stop.patch and it can be found in the queue-4.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From foo@baz Sat Sep 26 11:13:07 PDT 2015 From: Oleg Nesterov <oleg@xxxxxxxxxx> Date: Wed, 8 Jul 2015 21:42:11 +0200 Subject: net: pktgen: fix race between pktgen_thread_worker() and kthread_stop() From: Oleg Nesterov <oleg@xxxxxxxxxx> [ Upstream commit fecdf8be2d91e04b0a9a4f79ff06499a36f5d14f ] pktgen_thread_worker() is obviously racy, kthread_stop() can come between the kthread_should_stop() check and set_current_state(). Signed-off-by: Oleg Nesterov <oleg@xxxxxxxxxx> Reported-by: Jan Stancek <jstancek@xxxxxxxxxx> Reported-by: Marcelo Leitner <mleitner@xxxxxxxxxx> Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- net/core/pktgen.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/net/core/pktgen.c +++ b/net/core/pktgen.c @@ -3490,8 +3490,10 @@ static int pktgen_thread_worker(void *ar pktgen_rem_thread(t); /* Wait for kthread_stop */ - while (!kthread_should_stop()) { + for (;;) { set_current_state(TASK_INTERRUPTIBLE); + if (kthread_should_stop()) + break; schedule(); } __set_current_state(TASK_RUNNING); Patches currently in stable-queue which might be from oleg@xxxxxxxxxx are queue-4.1/net-pktgen-fix-race-between-pktgen_thread_worker-and-kthread_stop.patch -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html