All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 1/3] vt: fix check for system/busy console drivers when unregistering them
@ 2014-12-15 22:15 Imre Deak
  2014-12-15 22:16 ` [PATCH v4 2/3] vt: fix locking around vt_bind/vt_unbind Imre Deak
                   ` (2 more replies)
  0 siblings, 3 replies; 22+ messages in thread
From: Imre Deak @ 2014-12-15 22:15 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Jiri Slaby; +Cc: Peter Hurley, Daniel Vetter, linux-kernel

The default console driver (conswitchp) and busy drivers bound to a
console (as reported by con_is_bound()) shouldn't be unregistered.
System console drivers (without the CON_DRIVER_FLAG_MODULE flag) can be
unregistered, provided they are neither default nor busy. The current
code checks for the CON_DRIVER_FLAG_INIT flag but this doesn't make
sense: this flag is set for a driver whenever its associated console's
con_startup() function is called, which first happens when the console
driver is registered (so before the console gets bound) and gets cleared
when the console gets unbound. The purpose of this flag is to show if we
need to call con_startup() on a console before we use it.

Based on the above, do_unregister_con_driver() in its current form will
allow unregistering a console driver only if it was never bound, but
will refuse to unregister one that was bound and later unbound.

Fix this by dropping the CON_DRIVER_FLAG_INIT check, allowing
unregistering of any console driver provided that it's not the default
one and it's not busy.

v2:
- reword the third paragraph to clarify how the fix works (Peter Hurley)
v3:
- unchanged
v4:
- Allow unregistering a system console driver too, needed by i915 to
  unregister vgacon. Update commit description accordingly. (Daniel)

Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 drivers/tty/vt/vt.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
index f3fbbbc..9c046fb 100644
--- a/drivers/tty/vt/vt.c
+++ b/drivers/tty/vt/vt.c
@@ -3665,8 +3665,7 @@ int do_unregister_con_driver(const struct consw *csw)
 	for (i = 0; i < MAX_NR_CON_DRIVER; i++) {
 		struct con_driver *con_driver = &registered_con_driver[i];
 
-		if (con_driver->con == csw &&
-		    con_driver->flag & CON_DRIVER_FLAG_INIT) {
+		if (con_driver->con == csw) {
 			vtconsole_deinit_device(con_driver);
 			device_destroy(vtconsole_class,
 				       MKDEV(0, con_driver->node));
-- 
1.8.4


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

end of thread, other threads:[~2015-04-01 18:06 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-15 22:15 [PATCH v4 1/3] vt: fix check for system/busy console drivers when unregistering them Imre Deak
2014-12-15 22:16 ` [PATCH v4 2/3] vt: fix locking around vt_bind/vt_unbind Imre Deak
2014-12-16  7:37   ` Daniel Vetter
2014-12-15 22:16 ` [PATCH v4 3/3] vt: fix console lock vs. kernfs s_active lock order Imre Deak
2014-12-16  7:53   ` Daniel Vetter
2014-12-16 10:23     ` Imre Deak
2014-12-16 12:50       ` Peter Hurley
2014-12-16 13:45         ` Daniel Vetter
2014-12-16 14:38         ` Imre Deak
2014-12-16 15:00           ` Peter Hurley
2014-12-16 15:10             ` Daniel Vetter
2014-12-16 15:48               ` Peter Hurley
2014-12-16 16:22             ` Imre Deak
2014-12-16 17:15               ` Peter Hurley
2014-12-16 17:42                 ` Daniel Vetter
2015-03-26 19:59                   ` Jesse Barnes
2015-03-26 21:01                     ` Greg Kroah-Hartman
2015-03-26 21:05                       ` Imre Deak
2015-03-27  7:46                         ` Daniel Vetter
2015-03-31 15:59                           ` Greg Kroah-Hartman
2015-04-01 18:06                             ` [PATCH] " Imre Deak
2014-12-16  7:35 ` [PATCH v4 1/3] vt: fix check for system/busy console drivers when unregistering them Daniel Vetter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.