aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/tty/pty.c6
-rw-r--r--drivers/tty/tty_io.c5
2 files changed, 7 insertions, 4 deletions
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index b25d6c4014a5..21bddf359dbb 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -304,7 +304,7 @@ static int pty_install(struct tty_driver *driver, struct tty_struct *tty)
304 the easy way .. */ 304 the easy way .. */
305 retval = tty_init_termios(tty); 305 retval = tty_init_termios(tty);
306 if (retval) 306 if (retval)
307 goto err_module_put; 307 goto err_deinit_tty;
308 308
309 retval = tty_init_termios(o_tty); 309 retval = tty_init_termios(o_tty);
310 if (retval) 310 if (retval)
@@ -327,7 +327,8 @@ static int pty_install(struct tty_driver *driver, struct tty_struct *tty)
327 return 0; 327 return 0;
328err_free_termios: 328err_free_termios:
329 tty_free_termios(tty); 329 tty_free_termios(tty);
330err_module_put: 330err_deinit_tty:
331 deinitialize_tty_struct(o_tty);
331 module_put(o_tty->driver->owner); 332 module_put(o_tty->driver->owner);
332err_free_tty: 333err_free_tty:
333 free_tty_struct(o_tty); 334 free_tty_struct(o_tty);
@@ -592,6 +593,7 @@ static int pty_unix98_install(struct tty_driver *driver, struct tty_struct *tty)
592 pty_count++; 593 pty_count++;
593 return 0; 594 return 0;
594err_free_mem: 595err_free_mem:
596 deinitialize_tty_struct(o_tty);
595 kfree(o_tty->termios); 597 kfree(o_tty->termios);
596 kfree(tty->termios); 598 kfree(tty->termios);
597 module_put(o_tty->driver->owner); 599 module_put(o_tty->driver->owner);
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index f5dd23520fe3..8540f2bab9c6 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -1399,7 +1399,7 @@ struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx,
1399 1399
1400 retval = tty_driver_install_tty(driver, tty); 1400 retval = tty_driver_install_tty(driver, tty);
1401 if (retval < 0) 1401 if (retval < 0)
1402 goto err_free_tty; 1402 goto err_deinit_tty;
1403 1403
1404 /* 1404 /*
1405 * Structures all installed ... call the ldisc open routines. 1405 * Structures all installed ... call the ldisc open routines.
@@ -1411,7 +1411,8 @@ struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx,
1411 goto err_release_tty; 1411 goto err_release_tty;
1412 return tty; 1412 return tty;
1413 1413
1414err_free_tty: 1414err_deinit_tty:
1415 deinitialize_tty_struct(tty);
1415 free_tty_struct(tty); 1416 free_tty_struct(tty);
1416err_module_put: 1417err_module_put:
1417 module_put(driver->owner); 1418 module_put(driver->owner);