Skip to contentSkip to conversation

Char: tty, fix tty_port_block_til_ready waiting

PATCH In review Jiri Slaby 2 participants 3 messages Jun 18, 2009 – Jun 24, 2009 Char and misc drivers

lore
Share & tools
lore

Jiri Slaby

author
#0 lore raw

PATCH v2 1/1 Char: tty, fix tty_port_block_til_ready waiting

Use DEFINE_WAIT instead DECLARE_WAITQUEUE, because we use prepare/finish_wait since commit 3e3b5c087799e536871c8261b05bc28e4783c8da
(tty: use prepare/finish_wait)

Otherwise we would oops in finish_wait.

---
 drivers/char/tty_port.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/char/tty_port.c +1 -1
index 62dadfc..4e862a7 100644
@@ -193,7 +193,7 @@ int tty_port_block_til_ready(struct tty_port *port,
 {
 	int do_clocal = 0, retval;
 	unsigned long flags;
-	DECLARE_WAITQUEUE(wait, current);
+	DEFINE_WAIT(wait);
 	int cd;
 
 	/* block if port is in the process of being closed */
Signature · 1 line
1.6.3.2
#1 lore raw
Quoted 7 lines · On Thu, 18 Jun 2009 09:46:13 +0200 Jiri Slaby <[email protected]> wrote:

Use DEFINE_WAIT instead DECLARE_WAITQUEUE, because we use prepare/finish_wait since commit 3e3b5c087799e536871c8261b05bc28e4783c8da
(tty: use prepare/finish_wait)

Otherwise we would oops in finish_wait.

<scratches head for a while>

OK, here's a better changelog:

Since commit 3e3b5c087799e536871c8261b05bc28e4783c8da ("tty: use prepare/finish_wait"), tty_port_block_til_ready() is using prepare_to_wait()/finish_wait(). Those functions require that the wait_queue_t be initialised with .func=autoremove_wake_function, via DEFINE_WAIT().

But the conversion from DECLARE_WAITQUEUE() to DEFINE_WAIT() was not made, so this code will oops in finish_wait().

Quoted 6 lines
drivers/char/tty_port.c +0 -0
index 62dadfc..4e862a7 100644

drivers/char/tty_port.c int tty_port_block_til_ready(struct tty_port *port, · line 199

Quoted 8 lines
drivers/char/tty_port.c +1 -1
@@ -193,7 +193,7 @@ int tty_port_block_til_ready(struct tty_port *port,
 {
 	int do_clocal = 0, retval;
 	unsigned long flags;
-	DECLARE_WAITQUEUE(wait, current);
+	DEFINE_WAIT(wait);
 	int cd;
 
 	/* block if port is in the process of being closed */

Why is nobody reporting the oopses?

author
#2 lore raw
Quoted 11 lines · Andrew Morton

On Thu, 18 Jun 2009 09:46:13 +0200

Quoted 10 lines
drivers/char/tty_port.c +1 -1
@@ -193,7 +193,7 @@ int tty_port_block_til_ready(struct tty_port *port,
 {
 	int do_clocal = 0, retval;
 	unsigned long flags;
-	DECLARE_WAITQUEUE(wait, current);
+	DEFINE_WAIT(wait);
 	int cd;
 
Quoted 3 lines

drivers/char/tty_port.c int tty_port_block_til_ready(struct tty_port *port, · line 199

Quoted 1 line
drivers/char/tty_port.c +0 -0
 	/* block if port is in the process of being closed */

Why is nobody reporting the oopses?

Myaybe because only few drivers use that function. I hit it the first time I tested cyclades patchset.