Skip to contentSkip to conversation

Patch "net: pktgen: fix race between pktgen_thread_worker() and kthread_stop()" has been added to the 3.14-stable tree

PATCH [email protected] 1 participant 1 message Sep 26, 2015

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

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 3.14-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-3.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Sat Sep 26 11:19:08 PDT 2015

From: Oleg Nesterov <[email protected]>
Date: Wed, 8 Jul 2015 21:42:11 +0200
Subject: net: pktgen: fix race between pktgen_thread_worker() and kthread_stop()

From: Oleg Nesterov <[email protected]>

[ Upstream commit fecdf8be2d91e04b0a9a4f79ff06499a36f5d14f ]

pktgen_thread_worker() is obviously racy, kthread_stop() can come between the kthread_should_stop() check and set_current_state().

---
 net/core/pktgen.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
net/core/pktgen.c +3 -1
@@ -3464,8 +3464,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 [email protected] are

queue-3.14/net-pktgen-fix-race-between-pktgen_thread_worker-and-kthread_stop.patch