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: <Y+UMkA9iaJTWVQ5u@rowland.harvard.edu>
Date:   Thu, 9 Feb 2023 10:09:04 -0500
From:   Alan Stern <stern@...land.harvard.edu>
To:     Prashanth K <quic_prashk@...cinc.com>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        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 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.

Alan Stern

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ