All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] vt: Fix module ref counting
@ 2006-06-25 10:04 Antonino A. Daplas
  0 siblings, 0 replies; only message in thread
From: Antonino A. Daplas @ 2006-06-25 10:04 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Linux Fbdev development list

Unbinding a console driver does not set the module ref count to zero. This is
due to the following:

1. vgacon may point the default console driver pointer (conswitchp) to
dummycon, so when a module_put(conswitchp->owner) is done, it decrements
the ref count of dummycon, not fbcon.

2. Pass a unique minor number (con_driver->node) to class_device_create(),
otherwise, class_device_destroy() may get confused.

Signed-off-by: Antonino Daplas <adaplas@pol.net>
---

 drivers/char/vt.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/char/vt.c b/drivers/char/vt.c
index bd667d9..714d95f 100644
--- a/drivers/char/vt.c
+++ b/drivers/char/vt.c
@@ -2873,8 +2873,15 @@ static int unbind_con_driver(const struc
 	}
 
 	if (!con_is_bound(defcsw)) {
+		const struct consw *defconsw = conswitchp;
+
 		defcsw->con_startup();
 		con_back->flag |= CON_DRIVER_FLAG_INIT;
+		/*
+		 * vgacon may change the default driver to point
+		 * to dummycon, we restore it here...
+		 */
+		conswitchp = defconsw;
 	}
 
 	if (!con_is_bound(csw))
@@ -3131,8 +3138,8 @@ int register_con_driver(const struct con
 		goto err;
 
 	con_driver->class_dev = class_device_create(vtconsole_class, NULL,
-						    MKDEV(0, 0), NULL,
-						    "vtcon%i",
+						    MKDEV(0, con_driver->node),
+						    NULL, "vtcon%i",
 						    con_driver->node);
 
 	if (IS_ERR(con_driver->class_dev)) {
@@ -3177,7 +3184,8 @@ int unregister_con_driver(const struct c
 		if (con_driver->con == csw &&
 		    con_driver->flag & CON_DRIVER_FLAG_MODULE) {
 			vtconsole_deinit_class_device(con_driver);
-			class_device_destroy(vtconsole_class, MKDEV(0, 0));
+			class_device_destroy(vtconsole_class,
+					     MKDEV(0, con_driver->node));
 			con_driver->con = NULL;
 			con_driver->desc = NULL;
 			con_driver->class_dev = NULL;
@@ -3241,7 +3249,7 @@ static int __init vtconsole_class_init(v
 		if (con->con && !con->class_dev) {
 			con->class_dev =
 				class_device_create(vtconsole_class, NULL,
-						    MKDEV(0, 0), NULL,
+						    MKDEV(0, con->node), NULL,
 						    "vtcon%i", con->node);
 
 			if (IS_ERR(con->class_dev)) {


Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

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

only message in thread, other threads:[~2006-06-25 10:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-25 10:04 [PATCH] vt: Fix module ref counting Antonino A. Daplas

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.