From: "Antonino A. Daplas" <adaplas@gmail.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Linux Fbdev development list <linux-fbdev-devel@lists.sourceforge.net>
Subject: [PATCH] vt: Fix module ref counting
Date: Sun, 25 Jun 2006 18:04:45 +0800 [thread overview]
Message-ID: <449E5FBD.2030309@gmail.com> (raw)
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
reply other threads:[~2006-06-25 10:11 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=449E5FBD.2030309@gmail.com \
--to=adaplas@gmail.com \
--cc=akpm@osdl.org \
--cc=linux-fbdev-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).