From: David Miller <davem@davemloft.net>
To: sasha.levin@oracle.com
Cc: samuel@sortiz.org, gregkh@linuxfoundation.org, jslaby@suse.cz,
peter@hurleysoftware.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ircomm: release tty before sleeping potentially indefintely
Date: Sun, 03 Mar 2013 19:31:27 -0500 (EST) [thread overview]
Message-ID: <20130303.193127.656411242317130530.davem@davemloft.net> (raw)
In-Reply-To: <5133DA12.8020907@oracle.com>
From: Sasha Levin <sasha.levin@oracle.com>
Date: Sun, 03 Mar 2013 18:17:38 -0500
> On 03/03/2013 05:47 PM, David Miller wrote:
>> From: Sasha Levin <sasha.levin@oracle.com>
>> Date: Sun, 3 Mar 2013 17:35:53 -0500
>>
>>> ircomm_tty_block_til_ready would hold tty lock while blocking. Since the sleep
>>> might take a long time we can prevent other processes from accessing the tty,
>>> causing hung tasks and a dead tty.
>>>
>>> Diagnosed-by: Peter Hurley <peter@hurleysoftware.com>
>>> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
>>
>> But then you invalidate all of the tty state tests made under
>> the lock at the beginning of this function, before enterring
>> the loop. If you drop the lock, those pieces of state could
>> change.
>>
>> I'm not applying this.
>
> I'm unsure. A similar patch was applied back in 2010 that does the same thing
> to a bunch of drivers, including the core tty code (e142a31da "tty: release
> BTM while sleeping in block_til_ready").
>
> This IR code looks very much like tty_port_block_til_ready() where it was
> okay to do that change, so I should be the same with ircomm_tty_block_til_ready.
That assumes that the other changes don't have the same bug.
Releasing locks are dangerous, because it invalidates the context in
which all previous tests of state have been performed. Anything can
happen to the TTY once you drop that lock.
next prev parent reply other threads:[~2013-03-04 0:31 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-03 22:35 [PATCH] ircomm: release tty before sleeping potentially indefintely Sasha Levin
2013-03-03 22:47 ` David Miller
2013-03-03 23:17 ` Sasha Levin
2013-03-04 0:31 ` David Miller [this message]
2013-03-04 0:04 ` Peter Hurley
2013-03-04 0:33 ` David Miller
2013-03-04 1:06 ` Peter Hurley
2013-03-04 2:36 ` David Miller
2013-03-04 4:24 ` Peter Hurley
2013-03-05 16:09 ` [PATCH 0/4] other ircomm_tty fixes (was Re: [PATCH] ircomm: release tty before sleeping potentially indefintely) Peter Hurley
2013-03-05 16:09 ` [PATCH 1/4] net/irda: Fix port open counts Peter Hurley
2013-03-05 16:09 ` [PATCH 2/4] net/irda: Hold port lock while bumping blocked_open Peter Hurley
2013-03-05 16:09 ` [PATCH 3/4] net/irda: Use barrier to set task state Peter Hurley
2013-03-05 16:09 ` [PATCH 4/4] net/irda: Raise dtr in non-blocking open Peter Hurley
2013-03-06 4:44 ` [PATCH 0/4] other ircomm_tty fixes David Miller
2013-03-04 4:30 ` [PATCH] ircomm: release tty before sleeping potentially indefintely Peter Hurley
2013-03-04 2:23 ` Peter Hurley
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=20130303.193127.656411242317130530.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=peter@hurleysoftware.com \
--cc=samuel@sortiz.org \
--cc=sasha.levin@oracle.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;
as well as URLs for NNTP newsgroup(s).