public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] vt: fix potential dual con_driver register for conswitchp
@ 2013-12-29  3:03 Wang YanQing
  0 siblings, 0 replies; only message in thread
From: Wang YanQing @ 2013-12-29  3:03 UTC (permalink / raw)
  To: gregkh; +Cc: jslaby, airlied, akpm, kilobyte, linux-kernel

We should check whether conswitchp is registered before
add it to registered_con_driver in con_init, or it will
cause dual con_driver register for conswitchp.

Although I haven't met it in reality, but I think it could
happen for Embeded devices, who register platform con_driver
earlier than call con_init.

Signed-off-by: Wang YanQing <udknight@gmail.com>
---
 drivers/tty/vt/vt.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index edcd6b8..3de4504 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -2876,6 +2876,8 @@ static int __init con_init(void)
 	for (i = 0; i < MAX_NR_CON_DRIVER; i++) {
 		struct con_driver *con_driver = &registered_con_driver[i];
 
+		if (con_driver->con == conswitchp)
+			break;
 		if (con_driver->con == NULL) {
 			con_driver->con = conswitchp;
 			con_driver->desc = display_desc;
-- 
1.8.3.4.8.g69490f3.dirty

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-12-29  3:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-29  3:03 [PATCH] vt: fix potential dual con_driver register for conswitchp Wang YanQing

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox