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]
Message-ID: <d858c7d2-c96c-f0dd-c5eb-bedd9187f8d8@cogentembedded.com>
Date:   Sat, 3 Dec 2016 00:28:27 +0300
From:   Nikita Yushchenko <nikita.yoush@...entembedded.com>
To:     Stefan Agner <stefan@...er.ch>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Jiri Slaby <jslaby@...e.com>,
        Bhuvanchandra DV <bhuvanchandra.dv@...adex.com>,
        Wei Yongjun <weiyongjun1@...wei.com>,
        Aaron Brice <aaron.brice@...asoft.com>,
        Nicolae Rosia <nicolae_rosia@...tor.com>,
        linux-serial@...r.kernel.org, Chris Healy <cphealy@...il.com>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] tty: serial: fsl_lpuart: fix del_timer_sync() vs timer
 routine deadlock

>> Problem found via lockdep:
>>
>> - lpuart_set_termios() calls del_timer_sync(&sport->lpuart_timer) while
>>   holding sport->port.lock
>>
>> - sport->lpuart_timer routine is lpuart_timer_func() that calls
>>   lpuart_copy_rx_to_tty() that acquires same lock.
>>
>> To fix, move Rx DMA stopping out of lock, as it already is in other places
>> in the same file.
>>
>> While at it, also make Rx DMA start/stop code to look the same is in
>> other places in the same file.
> 
> Yeah I saw that too, never really came around to look closer into it.
> 
> Thanks for looking into it.
> 
> You removed the check whether there was an old configuration, I think
> the idea of that was that we only resize DMA if it was configured
> differently before...

Per my code reading, checking for sport->lpuart_dma_rx_use should be
enough, this flag will be set only if DMA was previously enabled,

>> +	if (sport->lpuart_dma_rx_use) {
>> +		if (!lpuart_start_rx_dma(sport)) {
>>  			sport->lpuart_dma_rx_use = true;
> 
> No need to set to true here, it is guaranteed to be true at this point.

I've seen this...  However elsewhere in this file (namely in
lpuart_resume(), in very similar situation, code is exactly the same,
i.e. it sets sport->lpuart_dma_rx_use in both clauses. I thought it
could be for a reason (i.e. for readability).

Nikita

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ