diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 05badbb588659eaba8db986900f22f104d498dc0..41489e3c69af020bae4a083ec728a02b453f348f 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -3572,8 +3572,10 @@ static int pktgen_thread_worker(void *arg)
 	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);