[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20130303.193127.656411242317130530.davem@davemloft.net>
Date: Sun, 03 Mar 2013 19:31:27 -0500 (EST)
From: David Miller <davem@...emloft.net>
To: sasha.levin@...cle.com
Cc: samuel@...tiz.org, gregkh@...uxfoundation.org, jslaby@...e.cz,
peter@...leysoftware.com, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ircomm: release tty before sleeping potentially
indefintely
From: Sasha Levin <sasha.levin@...cle.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@...cle.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@...leysoftware.com>
>>> Signed-off-by: Sasha Levin <sasha.levin@...cle.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.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists