Patch "serial: sunsab: Fix error handling in sunsab_init()" has been added to the 5.10-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

    serial: sunsab: Fix error handling in sunsab_init()

to the 5.10-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:
     serial-sunsab-fix-error-handling-in-sunsab_init.patch
and it can be found in the queue-5.10 subdirectory.

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



commit 68cb56f4d6705dacbe460b9af14e2f843dc977d4
Author: Yuan Can <yuancan@xxxxxxxxxx>
Date:   Wed Nov 23 06:12:12 2022 +0000

    serial: sunsab: Fix error handling in sunsab_init()
    
    [ Upstream commit 1a6ec673fb627c26e2267ca0a03849f91dbd9b40 ]
    
    The sunsab_init() returns the platform_driver_register() directly without
    checking its return value, if platform_driver_register() failed, the
    allocated sunsab_ports is leaked.
    Fix by free sunsab_ports and set it to NULL when platform_driver_register()
    failed.
    
    Fixes: c4d37215a824 ("[SERIAL] sunsab: Convert to of_driver framework.")
    Signed-off-by: Yuan Can <yuancan@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20221123061212.52593-1-yuancan@xxxxxxxxxx
    Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/tty/serial/sunsab.c b/drivers/tty/serial/sunsab.c
index bab551f46963..451c7233623f 100644
--- a/drivers/tty/serial/sunsab.c
+++ b/drivers/tty/serial/sunsab.c
@@ -1137,7 +1137,13 @@ static int __init sunsab_init(void)
 		}
 	}
 
-	return platform_driver_register(&sab_driver);
+	err = platform_driver_register(&sab_driver);
+	if (err) {
+		kfree(sunsab_ports);
+		sunsab_ports = NULL;
+	}
+
+	return err;
 }
 
 static void __exit sunsab_exit(void)



[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