Re: Subject: [PATCH] tty ldisc: Close/Reopen race prevention shouldcheck the proper flag

From: Shachar Shemesh
Date: Tue Jul 10 2012 - 00:54:16 EST


On 07/09/2012 07:44 PM, Greg KH wrote:
Yes, that worked, but then I would have to edit the body to include the
above information in the patch properly.

So, care to resend it all in a "clean" format that I can apply it in?

thanks,

greg k-h

After a few tests, it seems the only reliable way to get my mailer to not munge the tabs is an attachment. I've included the entire details inside the attachment. Hopefully, that will be parsable to everyone.

Shachar From: Shachar Shemesh <shachar@xxxxxxxx>

Commit acfa747b introduced the TTY_HUPPING flag to distinguish
closed TTY from currently closing ones. The test in tty_set_ldisc
still remained pointing at the old flag. This causes pppd to
sometimes lapse into uninterruptible sleep when killed and
restarted.

Signed-off-by: Shachar Shemesh <shachar@xxxxxxxx>
---
Tested with 3.2.20 kernel.

diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c
index 24b95db..a662a24 100644
--- a/drivers/tty/tty_ldisc.c
+++ b/drivers/tty/tty_ldisc.c
@@ -658,7 +658,7 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc)
goto enable;
}

- if (test_bit(TTY_HUPPED, &tty->flags)) {
+ if (test_bit(TTY_HUPPING, &tty->flags)) {
/* We were raced by the hangup method. It will have stomped
the ldisc data and closed the ldisc down */
clear_bit(TTY_LDISC_CHANGING, &tty->flags);