2013-04-12 08:34:36

by Johan Hovold

[permalink] [raw]
Subject: [PATCH 0/4] TTY: fix DTR being raised on hang up

These patches fix four custom block_til_ready implementations which
could raise DTR after first having dropped it at hangup.

This was fixed in the tty-port implementation by commit e584a02cf ("TTY:
fix DTR being raised on hang up") in tty-next.

Note that the crisv10-driver still suffers from this behaviour but is
broken in other ways as it, for example, does not honour CBAUD or raise
DTR at non-blocking open.

Thanks,
Johan


Johan Hovold (4):
TTY: synclink: fix DTR being raised on hang up
TTY: synclink_gt: fix DTR being raised on hang up
TTY: synclinkmp: fix DTR being raised on hang up
TTY: ircomm: fix DTR being raised on hang up

drivers/tty/synclink.c | 2 +-
drivers/tty/synclink_gt.c | 2 +-
drivers/tty/synclinkmp.c | 2 +-
net/irda/ircomm/ircomm_tty.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)

--
1.8.1.5


2013-04-12 08:33:56

by Johan Hovold

[permalink] [raw]
Subject: [PATCH 2/4] TTY: synclink_gt: fix DTR being raised on hang up

Make sure to check ASYNC_INITIALISED before raising DTR when waking up
from blocked open in block_til_ready.

Currently DTR could get raised at hang up as a blocked process would
raise DTR unconditionally before checking for hang up and returning.

Signed-off-by: Johan Hovold <[email protected]>
---
drivers/tty/synclink_gt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/synclink_gt.c b/drivers/tty/synclink_gt.c
index aa9eece..1abf946 100644
--- a/drivers/tty/synclink_gt.c
+++ b/drivers/tty/synclink_gt.c
@@ -3308,7 +3308,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
port->blocked_open++;

while (1) {
- if ((tty->termios.c_cflag & CBAUD))
+ if (C_BAUD(tty) && test_bit(ASYNCB_INITIALIZED, &port->flags))
tty_port_raise_dtr_rts(port);

set_current_state(TASK_INTERRUPTIBLE);
--
1.8.1.5

2013-04-12 08:33:54

by Johan Hovold

[permalink] [raw]
Subject: [PATCH 3/4] TTY: synclinkmp: fix DTR being raised on hang up

Make sure to check ASYNC_INITIALISED before raising DTR when waking up
from blocked open in block_til_ready.

Currently DTR could get raised at hang up as a blocked process would
raise DTR unconditionally before checking for hang up and returning.

Signed-off-by: Johan Hovold <[email protected]>
---
drivers/tty/synclinkmp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/synclinkmp.c b/drivers/tty/synclinkmp.c
index 6d5780c..ff17138 100644
--- a/drivers/tty/synclinkmp.c
+++ b/drivers/tty/synclinkmp.c
@@ -3329,7 +3329,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,
port->blocked_open++;

while (1) {
- if (tty->termios.c_cflag & CBAUD)
+ if (C_BAUD(tty) && test_bit(ASYNCB_INITIALIZED, &port->flags))
tty_port_raise_dtr_rts(port);

set_current_state(TASK_INTERRUPTIBLE);
--
1.8.1.5

2013-04-12 08:34:40

by Johan Hovold

[permalink] [raw]
Subject: [PATCH 4/4] TTY: ircomm: fix DTR being raised on hang up

Make sure to check ASYNC_INITIALISED before raising DTR when waking up
from blocked open in ircomm_tty_block_til_ready.

Currently DTR could get raised at hang up as a blocked process would
raise DTR unconditionally before checking for hang up and returning.

Cc: David S. Miller <[email protected]>
Signed-off-by: Johan Hovold <[email protected]>
---
net/irda/ircomm/ircomm_tty.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c
index 362ba47..41ac7938 100644
--- a/net/irda/ircomm/ircomm_tty.c
+++ b/net/irda/ircomm/ircomm_tty.c
@@ -328,7 +328,7 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self,
spin_unlock_irqrestore(&port->lock, flags);

while (1) {
- if (tty->termios.c_cflag & CBAUD)
+ if (C_BAUD(tty) && test_bit(ASYNCB_INITIALIZED, &port->flags))
tty_port_raise_dtr_rts(port);

set_current_state(TASK_INTERRUPTIBLE);
--
1.8.1.5

2013-04-12 08:34:38

by Johan Hovold

[permalink] [raw]
Subject: [PATCH 1/4] TTY: synclink: fix DTR being raised on hang up

Make sure to check ASYNC_INITIALISED before raising DTR when waking up
from blocked open in block_til_ready.

Currently DTR could get raised at hang up as a blocked process would
raise DTR unconditionally before checking for hang up and returning.

Signed-off-by: Johan Hovold <[email protected]>
---
drivers/tty/synclink.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/synclink.c b/drivers/tty/synclink.c
index 72d6071..8eaf1ab 100644
--- a/drivers/tty/synclink.c
+++ b/drivers/tty/synclink.c
@@ -3308,7 +3308,7 @@ static int block_til_ready(struct tty_struct *tty, struct file * filp,
port->blocked_open++;

while (1) {
- if (tty->termios.c_cflag & CBAUD)
+ if (C_BAUD(tty) && test_bit(ASYNCB_INITIALIZED, &port->flags))
tty_port_raise_dtr_rts(port);

set_current_state(TASK_INTERRUPTIBLE);
--
1.8.1.5

2013-04-12 17:23:18

by David Miller

[permalink] [raw]
Subject: Re: [PATCH 4/4] TTY: ircomm: fix DTR being raised on hang up

From: Johan Hovold <[email protected]>
Date: Fri, 12 Apr 2013 10:32:31 +0200

> Make sure to check ASYNC_INITIALISED before raising DTR when waking up
> from blocked open in ircomm_tty_block_til_ready.
>
> Currently DTR could get raised at hang up as a blocked process would
> raise DTR unconditionally before checking for hang up and returning.
>
> Cc: David S. Miller <[email protected]>
> Signed-off-by: Johan Hovold <[email protected]>

Acked-by: David S. Miller <[email protected]>

2013-04-15 15:12:04

by Peter Hurley

[permalink] [raw]
Subject: Re: [PATCH 0/4] TTY: fix DTR being raised on hang up

On Fri, 2013-04-12 at 10:32 +0200, Johan Hovold wrote:
> These patches fix four custom block_til_ready implementations which
> could raise DTR after first having dropped it at hangup.
>
> This was fixed in the tty-port implementation by commit e584a02cf ("TTY:
> fix DTR being raised on hang up") in tty-next.
>
> Note that the crisv10-driver still suffers from this behaviour but is
> broken in other ways as it, for example, does not honour CBAUD or raise
> DTR at non-blocking open.

Thanks for fixing these.

Regards,
Peter Hurley