mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] staging: pi433: Return thread immediately when kthread_should_stop() call.
@ 2019-04-02 12:14 Sidong Yang
  0 siblings, 0 replies; only message in thread
From: Sidong Yang @ 2019-04-02 12:14 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Sidong Yang, Michael Straube, Hugo Lefeuvre, devel, linux-kernel

When kthread_stop() called by removing module, running thread should
return immediately. Otherwise, It is very dangerous that thread may access
any released data like struct pi433_device.

Signed-off-by: Sidong Yang <realwakka@gmail.com>
---
 drivers/staging/pi433/pi433_if.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/pi433/pi433_if.c b/drivers/staging/pi433/pi433_if.c
index ab90d6f80931..16dc380eb176 100644
--- a/drivers/staging/pi433/pi433_if.c
+++ b/drivers/staging/pi433/pi433_if.c
@@ -736,7 +736,7 @@ pi433_tx_thread(void *data)
 					 device->free_in_fifo == FIFO_SIZE ||
 					 kthread_should_stop());
 		if (kthread_should_stop())
-			dev_dbg(device->dev, "ABORT\n");
+			return 0;
 
 		/* STOP_TRANSMISSION */
 		dev_dbg(device->dev, "thread: Packet sent. Set mode to stby.");
-- 
2.11.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-04-02 12:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-02 12:14 [PATCH] staging: pi433: Return thread immediately when kthread_should_stop() call Sidong Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®