mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Peter Hurley <peter@hurleysoftware.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
	Alan Cox <alan@linux.intel.com>
Subject: Re: [PATCH RESEND] tty: don't dead lock while flushing workqueue
Date: Wed, 05 Dec 2012 17:15:40 +0100	[thread overview]
Message-ID: <50BF732C.6030306@linutronix.de> (raw)
In-Reply-To: <1354556465.2531.169.camel@thor>

On 12/03/2012 06:41 PM, Peter Hurley wrote:
> The lock logic for tty_set_ldisc() is wrong. Despite existing code in
> tty_set_ldisc() and tty_ldisc_hangup(), the ldisc_mutex does **not**
> (and should not) play a role in acquiring or releasing ldisc references.
> The only thing that needs to happen here is below (don't actually use
> below because I just hand-edited it):

Hmm. What about I stay in sync with the code that is already in tree
and if the wrong locking gets removed in both places later on?

Alan, what do you prefer?

>> See http://lkml.org/lkml/2012/11/21/347
>>
>>   drivers/tty/tty_ldisc.c |   13 +++++++++----
>>   1 file changed, 9 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c
>> index 0f2a2c5..fb76818 100644
>> --- a/drivers/tty/tty_ldisc.c
>> +++ b/drivers/tty/tty_ldisc.c
>> @@ -930,16 +930,21 @@ void tty_ldisc_release(struct tty_struct *tty, struct tty_struct *o_tty)
>>   	 */
>>
>> - 	tty_lock_pair(tty, o_tty);
>>   	tty_ldisc_halt(tty);
>> 	tty_ldisc_flush_works(tty);
>
>
>> +	tty_lock_pair(tty, o_tty);
>>   	/* This will need doing differently if we need to lock */
>>   	tty_ldisc_kill(tty);
>> -
>>   	if (o_tty)
>>   		tty_ldisc_kill(o_tty);
>>

Sebastian

  reply	other threads:[~2012-12-05 16:15 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-21 12:39 [PATCH] tty: don't dead " Sebastian Andrzej Siewior
2012-11-21 14:04 ` Alan Cox
2012-11-27  9:53   ` Sebastian Andrzej Siewior
2012-11-27 17:22     ` Greg Kroah-Hartman
2012-11-27 18:01       ` [PATCH RESEND] tty: don't dead lock " Sebastian Andrzej Siewior
2012-11-30 17:09         ` Sebastian Andrzej Siewior
2012-11-30 17:21           ` Greg Kroah-Hartman
2012-11-30 18:11             ` Sebastian Andrzej Siewior
2012-12-03 17:41         ` Peter Hurley
2012-12-05 16:15           ` Sebastian Andrzej Siewior [this message]
2012-12-05 17:11             ` Alan Cox
2012-12-25 22:02               ` [PATCH v3] tty: don't deadlock " Sebastian Andrzej Siewior

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=50BF732C.6030306@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=alan@linux.intel.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=peter@hurleysoftware.com \
    /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