Skip to contentSkip to conversation

staging: pi433: Return thread immediately when kthread_should_stop() call.

PATCH New Sidong Yang 1 participant 1 message Apr 2, 2019 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: pi433: Return thread immediately when kthread_should_stop() call.

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.

---
 drivers/staging/pi433/pi433_if.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/pi433/pi433_if.c +1 -1
index ab90d6f80931..16dc380eb176 100644
@@ -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.");
Signature · 1 line
2.11.0