tty: move the termios object into the tty
This will let us sort out a whole pile of tty related races. The alternative would be to keep points and refcount the termios objects. However 1. They are tiny anyway 2. Many devices don't use the stored copies 3. We can remove a pty special case Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Este cometimento está contido em:

cometido por
Greg Kroah-Hartman

ascendente
6d31a88cb2
cometimento
adc8d746ca
@@ -231,8 +231,8 @@ out:
|
||||
static void pty_set_termios(struct tty_struct *tty,
|
||||
struct ktermios *old_termios)
|
||||
{
|
||||
tty->termios->c_cflag &= ~(CSIZE | PARENB);
|
||||
tty->termios->c_cflag |= (CS8 | CREAD);
|
||||
tty->termios.c_cflag &= ~(CSIZE | PARENB);
|
||||
tty->termios.c_cflag |= (CS8 | CREAD);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -315,18 +315,10 @@ static int pty_common_install(struct tty_driver *driver, struct tty_struct *tty,
|
||||
driver->other->ttys[idx] = o_tty;
|
||||
driver->ttys[idx] = tty;
|
||||
} else {
|
||||
tty->termios = kzalloc(sizeof(struct ktermios[2]), GFP_KERNEL);
|
||||
if (tty->termios == NULL)
|
||||
goto err_deinit_tty;
|
||||
*tty->termios = driver->init_termios;
|
||||
tty->termios_locked = tty->termios + 1;
|
||||
|
||||
o_tty->termios = kzalloc(sizeof(struct ktermios[2]),
|
||||
GFP_KERNEL);
|
||||
if (o_tty->termios == NULL)
|
||||
goto err_free_termios;
|
||||
*o_tty->termios = driver->other->init_termios;
|
||||
o_tty->termios_locked = o_tty->termios + 1;
|
||||
memset(&tty->termios_locked, 0, sizeof(tty->termios_locked));
|
||||
tty->termios = driver->init_termios;
|
||||
memset(&o_tty->termios_locked, 0, sizeof(tty->termios_locked));
|
||||
o_tty->termios = driver->other->init_termios;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -349,8 +341,6 @@ static int pty_common_install(struct tty_driver *driver, struct tty_struct *tty,
|
||||
err_free_termios:
|
||||
if (legacy)
|
||||
tty_free_termios(tty);
|
||||
else
|
||||
kfree(tty->termios);
|
||||
err_deinit_tty:
|
||||
deinitialize_tty_struct(o_tty);
|
||||
module_put(o_tty->driver->owner);
|
||||
@@ -541,7 +531,6 @@ static void pty_unix98_shutdown(struct tty_struct *tty)
|
||||
{
|
||||
tty_driver_remove_tty(tty->driver, tty);
|
||||
/* We have our own method as we don't use the tty index */
|
||||
kfree(tty->termios);
|
||||
}
|
||||
|
||||
/* We have no need to install and remove our tty objects as devpts does all
|
||||
|
Criar uma nova questão referindo esta
Bloquear um utilizador