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:   Thu, 9 Feb 2023 21:13:37 +0530
From:   Prashanth K <quic_prashk@...cinc.com>
To:     Alan Stern <stern@...land.harvard.edu>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>
CC:     Christophe JAILLET <christophe.jaillet@...adoo.fr>,
        Xiu Jianfeng <xiujianfeng@...wei.com>,
        Pratham Pratap <quic_ppratap@...cinc.com>,
        "Jack Pham" <quic_jackp@...cinc.com>, <linux-usb@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] usb: gadget: u_serial: Add null pointer check in
 gserial_resume



On 09-02-23 08:39 pm, Alan Stern wrote:
> On Thu, Feb 09, 2023 at 07:37:01PM +0530, Prashanth K wrote:
>>
>>
>> On 09-02-23 12:33 pm, Prashanth K wrote:
>>>
>>>
>>> On 09-02-23 12:31 pm, Greg Kroah-Hartman wrote:
>>>> On Thu, Feb 09, 2023 at 10:31:50AM +0530, Prashanth K wrote:
>>>>> In that case i guess we have to make port_lock a global variable
>>>>> and take it
>>>>> out of gs_port structure.
>>>>>
>>>>> + static DEFINE_SPINLOCK(port_lock);
>>>>>
>>>>> struct gs_port {
>>>>>      struct tty_port port;
>>>>> -    spinlock_t port_lock;
>>>>>
>>>>> This will require us to change all the spinlock(port->port_lock) used in
>>>>> u_serial.c, what do you suggest?
>>>>
>>>> Yes, that would be the correct thing to do.
>> Hi Greg/Alan, One general doubt, if we make the spinlock static/global,
>> wouldn't that be a problem when there are multiple instances, and also
>> multiple interfaces can use u_serial at same time. Asking this because
>> u_serial can be used by f_serial (gser) as well as f_acm (acm).
> 
> You should consider having _two_ spinlocks: One in the gs_port structure
> (the way it is now) and a separate global lock.  The first would be used
> in situations where you know you have a valid pointer.  The second would
> be used in situations where you don't know if the pointer is non-NULL
> or where you are changing the pointer's value.
Lets say we replaced the existing spinlock in gserial_resume and 
gserial_disconnect with a new static spinlock, and kept the spinlocks in 
other functions unchanged. In that case, wouldn't it cause additional 
race conditions as we are using 2 different locks.

Thanks,
Prashanth K
> 
> Alan Stern

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ