public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tty/serial: Cancel work queue before closing uart
@ 2023-08-18  3:15 Wenhua Lin
  2023-08-22  4:37 ` kernel test robot
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Wenhua Lin @ 2023-08-18  3:15 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Orson Zhai, Baolin Wang, Chunyan Zhang, linux-serial,
	linux-kernel, wenhua lin, Wenhua Lin, Xiongpeng Wu, Zhirong Qiu,
	Zhaochen Su

When the system constantly sleeps and wankes up, plugging and unplugging
the USB will probalility trigger a kernel crash problem. The reason is
that at this time, the system entered deep and turned off uart, and the
abnormal behavior of plugging and upplugging the USB triggered the read
data process of uart, causing access to uart to hang. The final solution
we came up with is to cancel the work queue before shutting down uart
, while ensuring that there is no uart business.

Signed-off-by: Wenhua Lin <Wenhua.Lin@unisoc.com>
---
 drivers/tty/serial/sprd_serial.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/tty/serial/sprd_serial.c b/drivers/tty/serial/sprd_serial.c
index b58f51296ace..eddff4360155 100644
--- a/drivers/tty/serial/sprd_serial.c
+++ b/drivers/tty/serial/sprd_serial.c
@@ -20,6 +20,7 @@
 #include <linux/slab.h>
 #include <linux/tty.h>
 #include <linux/tty_flip.h>
+#include "../tty.h"
 
 /* device name */
 #define UART_NR_MAX		8
@@ -1221,7 +1222,10 @@ static int sprd_probe(struct platform_device *pdev)
 static int sprd_suspend(struct device *dev)
 {
 	struct sprd_uart_port *sup = dev_get_drvdata(dev);
+	struct uart_port *uport = &sup->port;
+	struct tty_port *tty = &uport->state->port;
 
+	tty_buffer_cancel_work(tty);
 	uart_suspend_port(&sprd_uart_driver, &sup->port);
 
 	return 0;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-08-24  2:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-18  3:15 [PATCH] tty/serial: Cancel work queue before closing uart Wenhua Lin
2023-08-22  4:37 ` kernel test robot
2023-08-22  8:23 ` Ilpo Järvinen
2023-08-24  2:30   ` wenhua lin
2023-08-22 13:27 ` Greg Kroah-Hartman
2023-08-24  2:36   ` wenhua lin

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