提交 07584d4a 编写于 作者: R Rasmus Villemoes 提交者: Greg Kroah-Hartman

drivers: tty: Fix use-after-free in pty_common_install

In 2c964a2f "drivers: tty: Merge alloc_tty_struct and
initialize_tty_struct", I messed up the refactorization of
pty_common_install, causing use-after-free and NULL pointer derefs on
various error paths. This should fix it.
Reported-by: NJulia Lawall <julia.lawall@lip6.fr>
Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NRasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 2c964a2f
......@@ -388,7 +388,7 @@ static int pty_common_install(struct tty_driver *driver, struct tty_struct *tty,
deinitialize_tty_struct(o_tty);
free_tty_struct(o_tty);
err_put_module:
module_put(o_tty->driver->owner);
module_put(driver->other->owner);
err:
kfree(ports[0]);
kfree(ports[1]);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册