Linux USB
 help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: Prashanth K <quic_prashk@quicinc.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	Xiu Jianfeng <xiujianfeng@huawei.com>,
	Pratham Pratap <quic_ppratap@quicinc.com>,
	Jack Pham <quic_jackp@quicinc.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: gadget: u_serial: Add null pointer check in gserial_resume
Date: Fri, 10 Feb 2023 10:47:53 -0500	[thread overview]
Message-ID: <Y+ZnKaeJx41xswpT@rowland.harvard.edu> (raw)
In-Reply-To: <bf3296be-10f7-5a43-5ae8-dfc5b6d41240@quicinc.com>

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

  reply	other threads:[~2023-02-10 15:47 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-08 13:54 [PATCH] usb: gadget: u_serial: Add null pointer check in gserial_resume Prashanth K
2023-02-08 14:54 ` Greg Kroah-Hartman
2023-02-08 15:45   ` Prashanth K
2023-02-08 20:21     ` Alan Stern
2023-02-09  5:01       ` Prashanth K
2023-02-09  7:01         ` Greg Kroah-Hartman
2023-02-09  7:03           ` Prashanth K
2023-02-09 14:07             ` Prashanth K
2023-02-09 15:09               ` Alan Stern
2023-02-09 15:43                 ` Prashanth K
2023-02-09 16:03                   ` Alan Stern
2023-02-09 18:27                     ` Prashanth K
2023-02-09 21:05                       ` Alan Stern
2023-02-10  6:22                         ` Prashanth K
2023-02-10  6:56                           ` Prashanth K
2023-02-10 15:47                             ` Alan Stern [this message]
2023-02-11  6:25                               ` Prashanth K

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y+ZnKaeJx41xswpT@rowland.harvard.edu \
    --to=stern@rowland.harvard.edu \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=quic_jackp@quicinc.com \
    --cc=quic_ppratap@quicinc.com \
    --cc=quic_prashk@quicinc.com \
    --cc=xiujianfeng@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox