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: <9d515be6-5430-7ca2-24e8-a8c3798beec9@huawei.com>
Date:   Thu, 31 Oct 2019 20:38:30 +0800
From:   Xiaoming Ni <nixiaoming@...wei.com>
To:     Jiri Slaby <jslaby@...e.com>, <gregkh@...uxfoundation.org>
CC:     <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] tty:n_gsm.c: destroy port by tty_port_destroy()

On 2019/10/31 18:11, Jiri Slaby wrote:
> On 24. 09. 19, 11:25, Xiaoming Ni wrote:
>> According to the comment of tty_port_destroy():
>>      When a port was initialized using tty_port_init, one has to destroy
>>      the port by tty_port_destroy();
> 
> It continues with a part saying:
>     Either indirectly by using tty_port refcounting
>     (tty_port_put) or directly if refcounting is not used.
> 
>> tty_port_init() is called in gsm_dlci_alloc()
>> so tty_port_destroy() needs to be called in gsm_dlci_free()
>>
>> Signed-off-by: Xiaoming Ni <nixiaoming@...wei.com>
>> ---
>>   drivers/tty/n_gsm.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c
>> index 36a3eb4..3f5bcc9 100644
>> --- a/drivers/tty/n_gsm.c
>> +++ b/drivers/tty/n_gsm.c
>> @@ -1681,6 +1681,7 @@ static void gsm_dlci_free(struct tty_port *port)
>>   
>>   	del_timer_sync(&dlci->t1);
>>   	dlci->gsm->dlci[dlci->addr] = NULL;
>> +	tty_port_destroy(&dlci->port);
> 
> This is wrong. gsm_dlci_free is tty_port_operations->destruct, i.e.
> n_gsm uses tty_port refcounting and tty_port_destroy was called on this
> port in tty_port_destructor already.
> 
> Greg, please revert.
> 
> thanks,
> 

Function call flow
tty_port_put
     ===>  tty_port_destructor
          ===> tty_port_destroy
               Port->ops->destruct(port);
                ===> .destruct = gsm_dlci_free

Thank you for your correction, I am wrong.

thanks

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ