From af2b8978585099e084aee1ed15c576ed619d3e4d Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Mon, 13 Oct 2008 10:43:58 +0100 Subject: [PATCH] --- yaml --- r: 113471 b: refs/heads/master c: 8dff04ea316125639120c0a565ce0346b892fef7 h: refs/heads/master i: 113469: 9c2e5483534d17f4754cf00bb9e96c31515c3bc3 113467: 7a72335c07317bff2fcf6c420beb1b6bb5a04866 113463: f3706991490ed3d95cf7d8556ab37e4435c43269 113455: 48625215b2789f3e99c350a2fe6710e0031a5505 113439: 078fed625ae1e8a1faacd75e19f45c40dfaf37de 113407: 305f80c7d739dac89b34fd3633c1c60111397c43 v: v3 --- [refs] | 2 +- trunk/drivers/char/pty.c | 18 +++++++----------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/[refs] b/[refs] index 7f3ab0107b04..379d1dae2a3c 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 335adde689150d2fcf4df3cb26a6fc6740ed1f3e +refs/heads/master: 8dff04ea316125639120c0a565ce0346b892fef7 diff --git a/trunk/drivers/char/pty.c b/trunk/drivers/char/pty.c index 3c6b7911665f..6d4582712b1f 100644 --- a/trunk/drivers/char/pty.c +++ b/trunk/drivers/char/pty.c @@ -488,7 +488,6 @@ static void pty_unix98_shutdown(struct tty_struct *tty) { /* 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 @@ -509,20 +508,17 @@ static int pty_unix98_install(struct tty_driver *driver, struct tty_struct *tty) } 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; - 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; - 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) @@ -540,10 +536,10 @@ static int pty_unix98_install(struct tty_driver *driver, struct tty_struct *tty) pty_count++; return 0; free_mem_out: - pty_unix98_shutdown(o_tty); + kfree(o_tty->termios); module_put(o_tty->driver->owner); free_tty_struct(o_tty); - pty_unix98_shutdown(tty); + kfree(tty->termios); return -ENOMEM; }