linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dtor_core@ameritech.net>
To: linux-kernel@vger.kernel.org
Cc: Vojtech Pavlik <vojtech@suse.cz>, Andrew Morton <akpm@osdl.org>
Subject: [2.6 RFC/PATCH] Input: possible deadlock in i8042
Date: Sun, 30 Nov 2003 03:03:57 -0500	[thread overview]
Message-ID: <200311300303.57654.dtor_core@ameritech.net> (raw)

If request_irq fails in i8042_open it will call serio_unregister_port,
which takes serio_sem. i8042_open may be called:

serio_register_port - serio_find_dev - dev->connect
serio_register_device - dev->connect

Both serio_register_port and serio_register_device take serio_sem as well.

I think that serio_{register|unregister}_port can be converted into
submitting requests to kseriod thus removing deadlock on the serio_sem.

The patch below is on top of serio* patches in Andrew Morton's -mm tree.

Dmitry

===================================================================


ChangeSet@1.1512, 2003-11-30 02:42:54-05:00, dtor_core@ameritech.net
  Input: Use kseriod to register/unregister serio ports


 serio.c |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

===================================================================

diff -Nru a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
--- a/drivers/input/serio/serio.c	Sun Nov 30 03:01:40 2003
+++ b/drivers/input/serio/serio.c	Sun Nov 30 03:01:40 2003
@@ -83,8 +83,10 @@
 	}
 }
 
-#define SERIO_RESCAN	1
-#define SERIO_RECONNECT	2
+#define SERIO_RESCAN		1
+#define SERIO_RECONNECT		2
+#define SERIO_REGISTER_PORT	3
+#define SERIO_UNREGISTER_PORT	4
 
 static DECLARE_WAIT_QUEUE_HEAD(serio_wait);
 static DECLARE_COMPLETION(serio_exited);
@@ -111,6 +113,14 @@
 			goto event_done;
 		
 		switch (event->type) {
+			case SERIO_REGISTER_PORT :
+				__serio_register_port(event->serio);
+				break;
+
+			case SERIO_UNREGISTER_PORT :
+				__serio_unregister_port(event->serio);
+				break;
+
 			case SERIO_RECONNECT :
 				if (event->serio->dev && event->serio->dev->reconnect)
 					if (event->serio->dev->reconnect(event->serio) == 0)
@@ -192,9 +202,7 @@
 
 void serio_register_port(struct serio *serio)
 {
-	down(&serio_sem);
-	__serio_register_port(serio);
-	up(&serio_sem);
+	serio_queue_event(serio, SERIO_REGISTER_PORT);
 }
 
 /*
@@ -210,9 +218,7 @@
 
 void serio_unregister_port(struct serio *serio)
 {
-	down(&serio_sem);
-	__serio_unregister_port(serio);
-	up(&serio_sem);
+	serio_queue_event(serio, SERIO_UNREGISTER_PORT);
 }
 
 /*


             reply	other threads:[~2003-11-30  8:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-30  8:03 Dmitry Torokhov [this message]
2003-11-30  9:00 ` [2.6 RFC/PATCH] Input: possible deadlock in i8042 Vojtech Pavlik
2003-11-30  9:19   ` Dmitry Torokhov
2003-12-01  6:58   ` Dmitry Torokhov
2003-12-01  6:59   ` Dmitry Torokhov

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=200311300303.57654.dtor_core@ameritech.net \
    --to=dtor_core@ameritech.net \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vojtech@suse.cz \
    /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).