提交 536a3440 编写于 作者: J Jiri Slaby 提交者: Greg Kroah-Hartman

TTY: ttyprintk, initialize tty_port earlier

After tty_register_driver is called, it is too late to initialize a
guy with which we operate in open. When a process already called
open(2) on that node, the structures may be in use uninitialized.

Move the initialization prior to tty_register_driver.
Signed-off-by: NJiri Slaby <jslaby@suse.cz>
Cc: Samo Pogacnik <samo_pogacnik@t-2.net>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 ee8b593a
......@@ -180,6 +180,10 @@ static int __init ttyprintk_init(void)
int ret = -ENOMEM;
void *rp;
tty_port_init(&tpk_port.port);
tpk_port.port.ops = &null_ops;
mutex_init(&tpk_port.port_write_mutex);
ttyprintk_driver = alloc_tty_driver(1);
if (!ttyprintk_driver)
return ret;
......@@ -210,10 +214,6 @@ static int __init ttyprintk_init(void)
goto error;
}
tty_port_init(&tpk_port.port);
tpk_port.port.ops = &null_ops;
mutex_init(&tpk_port.port_write_mutex);
return 0;
error:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册