All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oliver Neukum <oneukum@suse.de>
To: Alan Stern <stern@rowland.harvard.edu>, eli.billauer@gmail.com
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
	hdegoede@redhat.com
Subject: Re: [PATCH v2] usb: core: Solve race condition in anchor cleanup functions
Date: Thu, 30 Jul 2020 09:28:25 +0200	[thread overview]
Message-ID: <1596094105.2508.1.camel@suse.de> (raw)
In-Reply-To: <20200729133846.GA1530967@rowland.harvard.edu>

Am Mittwoch, den 29.07.2020, 09:38 -0400 schrieb Alan Stern:
 
> > -     spin_lock_irq(&anchor->lock);
> > -     while (!list_empty(&anchor->urb_list)) {
> > -             victim = list_entry(anchor->urb_list.prev, struct urb,
> > -                                 anchor_list);
> > -             /* we must make sure the URB isn't freed before we kill it*/
> > -             usb_get_urb(victim);
> > -             spin_unlock_irq(&anchor->lock);
> > -             /* this will unanchor the URB */
> > -             usb_kill_urb(victim);
> > -             usb_put_urb(victim);
> > +     do {
> >                spin_lock_irq(&anchor->lock);
> 
> All you have to do is move this spin_lock_irq() above the start of the 
> outer loop...

usb_kill_urb() is unfortunately an operation that can sleep.

	Regards
		Oliver


      parent reply	other threads:[~2020-07-30  7:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-29 10:31 [PATCH v2] usb: core: Solve race condition in anchor cleanup functions eli.billauer
2020-07-29 13:38 ` Alan Stern
2020-07-29 15:08   ` Eli Billauer
2020-07-30  7:28   ` Oliver Neukum [this message]

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=1596094105.2508.1.camel@suse.de \
    --to=oneukum@suse.de \
    --cc=eli.billauer@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hdegoede@redhat.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.