tty: pdc_cons, free tty_driver upon failure
authorJiri Slaby <jslaby@suse.cz>
Fri, 23 Jul 2021 07:43:17 +0000 (09:43 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 27 Jul 2021 10:17:21 +0000 (12:17 +0200)
pdc_console_tty_driver_init() does not free the allocated tty driver in
case tty_register_driver() fails. Add one tty_driver_kref_put() to the
error path.

Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
Cc: Helge Deller <deller@gmx.de>
Cc: linux-parisc@vger.kernel.org
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20210723074317.32690-9-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/parisc/kernel/pdc_cons.c

index 70c2a1648fc12d0a200dd3c1b5ab99b1ac51392e..2661cdd256ae7deabd69d06d492bc833f50e2a0d 100644 (file)
@@ -181,6 +181,7 @@ static int __init pdc_console_tty_driver_init(void)
        if (err) {
                printk(KERN_ERR "Unable to register the PDC console TTY driver\n");
                tty_port_destroy(&tty_port);
+               tty_driver_kref_put(driver);
                return err;
        }