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>
diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index b50fc1c..5ad7ccc 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -231,8 +231,8 @@
 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 @@
 		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 @@
 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 @@
 {
 	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