We need both termios and termios_locked so allocate them as one
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
{
/* We have our own method as we don't use the tty index */
kfree(tty->termios);
{
/* We have our own method as we don't use the tty index */
kfree(tty->termios);
- kfree(tty->termios_locked);
}
/* We have no need to install and remove our tty objects as devpts does all
}
/* We have no need to install and remove our tty objects as devpts does all
}
initialize_tty_struct(o_tty, driver->other, idx);
}
initialize_tty_struct(o_tty, driver->other, idx);
- tty->termios = kmalloc(sizeof(struct ktermios), GFP_KERNEL);
+ tty->termios = kzalloc(sizeof(struct ktermios[2]), GFP_KERNEL);
if (tty->termios == NULL)
goto free_mem_out;
*tty->termios = driver->init_termios;
if (tty->termios == NULL)
goto free_mem_out;
*tty->termios = driver->init_termios;
- tty->termios_locked = kzalloc(sizeof(struct ktermios), GFP_KERNEL);
- if (tty->termios_locked == NULL)
- goto free_mem_out;
- o_tty->termios = kmalloc(sizeof(struct ktermios), GFP_KERNEL);
+ tty->termios_locked = tty->termios + 1;
+
+ o_tty->termios = kzalloc(sizeof(struct ktermios[2]), GFP_KERNEL);
if (o_tty->termios == NULL)
goto free_mem_out;
*o_tty->termios = driver->other->init_termios;
if (o_tty->termios == NULL)
goto free_mem_out;
*o_tty->termios = driver->other->init_termios;
- o_tty->termios_locked = kzalloc(sizeof(struct ktermios), GFP_KERNEL);
- if (o_tty->termios_locked == NULL)
- goto free_mem_out;
+ o_tty->termios_locked = o_tty->termios + 1;
tty_driver_kref_get(driver->other);
if (driver->subtype == PTY_TYPE_MASTER)
tty_driver_kref_get(driver->other);
if (driver->subtype == PTY_TYPE_MASTER)
pty_count++;
return 0;
free_mem_out:
pty_count++;
return 0;
free_mem_out:
- pty_unix98_shutdown(o_tty);
module_put(o_tty->driver->owner);
free_tty_struct(o_tty);
module_put(o_tty->driver->owner);
free_tty_struct(o_tty);
- pty_unix98_shutdown(tty);