[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y+ZnKaeJx41xswpT@rowland.harvard.edu>
Date: Fri, 10 Feb 2023 10:47:53 -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 Fri, Feb 10, 2023 at 12:26:52PM +0530, Prashanth K wrote:
>
>
> > And this seems like a viable option to me, what do you suggest?
> >
> > gserial_disconnect {
> > spin_lock(static)
> > spin_lock(port)
> > ...
> > gser->ioport = NULL;
> > ...
> > spin_lock(port)
> > spin_unlock(static)
> >
> > }
> >
> > gserial_resume {
> > struct gs_port *port = gser->ioport;
> >
> > spin_lock(static)
> > if (!port)
> spin_unlock(static)
> > return
> > spin_lock(port)
If you want, you could move the spin_unlock(static) up to here. It
probably doesn't matter.
> >
> > ...
> > spin_unlock(port)
> > spin_unlock(static)
> > }
I agree, that should work fine.
Alan Stern
Powered by blists - more mailing lists