|
@@ -383,6 +383,10 @@ static int pty_common_install(struct tty_driver *driver, struct tty_struct *tty,
|
|
int idx = tty->index;
|
|
int idx = tty->index;
|
|
int retval = -ENOMEM;
|
|
int retval = -ENOMEM;
|
|
|
|
|
|
|
|
+ /* Opening the slave first has always returned -EIO */
|
|
|
|
+ if (driver->subtype != PTY_TYPE_MASTER)
|
|
|
|
+ return -EIO;
|
|
|
|
+
|
|
ports[0] = kmalloc(sizeof **ports, GFP_KERNEL);
|
|
ports[0] = kmalloc(sizeof **ports, GFP_KERNEL);
|
|
ports[1] = kmalloc(sizeof **ports, GFP_KERNEL);
|
|
ports[1] = kmalloc(sizeof **ports, GFP_KERNEL);
|
|
if (!ports[0] || !ports[1])
|
|
if (!ports[0] || !ports[1])
|
|
@@ -419,8 +423,6 @@ static int pty_common_install(struct tty_driver *driver, struct tty_struct *tty,
|
|
* Everything allocated ... set up the o_tty structure.
|
|
* Everything allocated ... set up the o_tty structure.
|
|
*/
|
|
*/
|
|
tty_driver_kref_get(driver->other);
|
|
tty_driver_kref_get(driver->other);
|
|
- if (driver->subtype == PTY_TYPE_MASTER)
|
|
|
|
- o_tty->count++;
|
|
|
|
/* Establish the links in both directions */
|
|
/* Establish the links in both directions */
|
|
tty->link = o_tty;
|
|
tty->link = o_tty;
|
|
o_tty->link = tty;
|
|
o_tty->link = tty;
|
|
@@ -432,6 +434,7 @@ static int pty_common_install(struct tty_driver *driver, struct tty_struct *tty,
|
|
|
|
|
|
tty_driver_kref_get(driver);
|
|
tty_driver_kref_get(driver);
|
|
tty->count++;
|
|
tty->count++;
|
|
|
|
+ o_tty->count++;
|
|
return 0;
|
|
return 0;
|
|
err_free_termios:
|
|
err_free_termios:
|
|
if (legacy)
|
|
if (legacy)
|