mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2]vt: fix potential dual con_driver register for conswitchp
@ 2013-12-30  3:21 Wang YanQing
  2014-01-09  4:33 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Wang YanQing @ 2013-12-30  3:21 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>
---
 Change v1-v2:
 1: if conswitchp is registered, then 
    make it become "system driver" by
    change value of first,last,flag.

 drivers/tty/vt/vt.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index 9adb4e0..b786129 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -2876,6 +2876,12 @@ 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) {
+			con_driver->flag = CON_DRIVER_FLAG_INIT;
+			con_driver->first = 0;
+			con_driver->last = MAX_NR_CONSOLES - 1;
+			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	[flat|nested] 2+ messages in thread

* Re: [PATCH v2]vt: fix potential dual con_driver register for conswitchp
  2013-12-30  3:21 [PATCH v2]vt: fix potential dual con_driver register for conswitchp Wang YanQing
@ 2014-01-09  4:33 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2014-01-09  4:33 UTC (permalink / raw)
  To: Wang YanQing, jslaby, airlied, akpm, kilobyte, linux-kernel

On Mon, Dec 30, 2013 at 11:21:18AM +0800, Wang YanQing wrote:
> 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.

Does that happen on those systems?  Let's not add code that's never
going to be use, and is not needed, right?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-01-09  4:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-30  3:21 [PATCH v2]vt: fix potential dual con_driver register for conswitchp Wang YanQing
2014-01-09  4:33 ` Greg KH

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

all inboxes | Powered by JetHome®