mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: "Stéphane Marchesin" <marcheu@chromium.org>
Cc: linux-kernel@vger.kernel.org, jslaby@suse.cz, olof@lixom.net,
	linux-serial@vger.kernel.org
Subject: Re: [PATCH] drivers/tty: Don't hangup shared ttys
Date: Tue, 11 Jun 2013 16:15:18 -0700	[thread overview]
Message-ID: <20130611231518.GA28106@kroah.com> (raw)
In-Reply-To: <1370991787-24141-1-git-send-email-marcheu@chromium.org>

On Tue, Jun 11, 2013 at 04:03:07PM -0700, Stéphane Marchesin wrote:
> When quickly restarting X servers, we can run into a situation where
> one X server quits while another one starts on the same tty. For a
> while, two X servers share the tty, and when the old X server
> eventually quits, the tty layer hangs up the tty, which among other
> things stubs out the tty's ioctl functions. Later on, the new X
> server (which shares the tty functions) tries to call some ioctls
> on the tty and fails because they have been replaced with the hungup
> versions. This in turn causes the new X server to abort.
> 
> This patch checks the tty->count to make sure we're the last
> consumer before hanging up a tty.
> 
> Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
> ---
>  drivers/tty/tty_io.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
> index 6464029..62a0f02 100644
> --- a/drivers/tty/tty_io.c
> +++ b/drivers/tty/tty_io.c
> @@ -619,6 +619,9 @@ static void __tty_hangup(struct tty_struct *tty, int exit_session)
>  	if (!tty)
>  		return;
>  
> +	/* Don't hangup if there are other users */
> +	if (tty->count > 1)
> +		return;

What happens when you have a "real" tty that was hungup because it was
disconnected physically from the system yet userspace had a tty open?
You want those ttys to be hungup properly, right?  Doesn't this change
break that?

thanks,

greg k-h

  reply	other threads:[~2013-06-11 23:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-11 23:03 Stéphane Marchesin
2013-06-11 23:15 ` Greg KH [this message]
2013-06-11 23:19   ` Stéphane Marchesin
2013-06-12  0:05     ` Greg KH

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=20130611231518.GA28106@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=marcheu@chromium.org \
    --cc=olof@lixom.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

Powered by JetHome