Patch "xtensa: ISS: don't panic in rs_init" has been added to the 4.19-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    xtensa: ISS: don't panic in rs_init

to the 4.19-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:
     xtensa-iss-don-t-panic-in-rs_init.patch
and it can be found in the queue-4.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 049031c0a7db2ca0b692ccb2635c611f42b08bd8
Author: Jiri Slaby <jirislaby@xxxxxxxxxx>
Date:   Fri Jul 23 09:43:10 2021 +0200

    xtensa: ISS: don't panic in rs_init
    
    [ Upstream commit 23411c720052ad860b3e579ee4873511e367130a ]
    
    While alloc_tty_driver failure in rs_init would mean we have much bigger
    problem, there is no reason to panic when tty_register_driver fails
    there. It can fail for various reasons.
    
    So handle the failure gracefully. Actually handle them both while at it.
    This will make at least the console functional as it was enabled earlier
    by console_initcall in iss_console_init. Instead of shooting down the
    whole system.
    
    We move tty_port_init() after alloc_tty_driver(), so that we don't need
    to destroy the port in case the latter function fails.
    
    Cc: Chris Zankel <chris@xxxxxxxxxx>
    Cc: Max Filippov <jcmvbkbc@xxxxxxxxx>
    Cc: linux-xtensa@xxxxxxxxxxxxxxxx
    Acked-by: Max Filippov <jcmvbkbc@xxxxxxxxx>
    Signed-off-by: Jiri Slaby <jslaby@xxxxxxx>
    Link: https://lore.kernel.org/r/20210723074317.32690-2-jslaby@xxxxxxx
    Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/xtensa/platforms/iss/console.c b/arch/xtensa/platforms/iss/console.c
index af81a62faba6..e7faea3d73d3 100644
--- a/arch/xtensa/platforms/iss/console.c
+++ b/arch/xtensa/platforms/iss/console.c
@@ -168,9 +168,13 @@ static const struct tty_operations serial_ops = {
 
 int __init rs_init(void)
 {
-	tty_port_init(&serial_port);
+	int ret;
 
 	serial_driver = alloc_tty_driver(SERIAL_MAX_NUM_LINES);
+	if (!serial_driver)
+		return -ENOMEM;
+
+	tty_port_init(&serial_port);
 
 	pr_info("%s %s\n", serial_name, serial_version);
 
@@ -190,8 +194,15 @@ int __init rs_init(void)
 	tty_set_operations(serial_driver, &serial_ops);
 	tty_port_link_device(&serial_port, serial_driver, 0);
 
-	if (tty_register_driver(serial_driver))
-		panic("Couldn't register serial driver\n");
+	ret = tty_register_driver(serial_driver);
+	if (ret) {
+		pr_err("Couldn't register serial driver\n");
+		tty_driver_kref_put(serial_driver);
+		tty_port_destroy(&serial_port);
+
+		return ret;
+	}
+
 	return 0;
 }
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux