lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 22 Nov 2013 09:22:19 +0100
From:	Andreas Platschek <andi.platschek@...il.com>
To:	wharms@....de
CC:	gregkh@...uxfoundation.org, jslaby@...e.cz,
	linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] tty: replace mutex_lock() with tty_write_lock()

Hi,

On 11/22/2013 09:09 AM, walter harms wrote:
>
> Am 21.11.2013 20:12, schrieb Andreas Platschek:
>> Use tty_write_lock()/tty_write_unlock() consistently.
>>
>> This takes care of the following sparse warning:
>> drivers/tty/tty_io.c:1169:17: warning: context imbalance in 'tty_write_message' - unexpected unlock
>>
>> Signed-off-by: Andreas Platschek <andi.platschek@...il.com>
>> ---
>>  drivers/tty/tty_io.c |    2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
>> index 3a1a01a..13dca92 100644
>> --- a/drivers/tty/tty_io.c
>> +++ b/drivers/tty/tty_io.c
>> @@ -1165,7 +1165,7 @@ out:
>>  void tty_write_message(struct tty_struct *tty, char *msg)
>>  {
>>  	if (tty) {
>> -		mutex_lock(&tty->atomic_write_lock);
>> +		tty_write_lock(tty,0);
>>  		tty_lock(tty);
>>  		if (tty->ops->write && !test_bit(TTY_CLOSING, &tty->flags)) {
>>  			tty_unlock(tty);
> i am not an expert on this but you may need to replace that tty_unlock() with tty_write_unlock()
The tty_unlock() you see in the patch belongs to the tty_lock() right
after the tty_write_lock(), the tty_write_unlock() is already in place
without my patch.

tty_lock()/tty_unlock() and tty_write_lock()/tty_write_unlock() are
operating on different mutexes, both are needed here.

thx!
Andi
>
> re,
>  wh

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ