From: Oliver Neukum <oneukum@suse.de>
To: eli.billauer@gmail.com, gregkh@linuxfoundation.org,
linux-usb@vger.kernel.org
Cc: hdegoede@redhat.com, stern@rowland.harvard.edu
Subject: Re: [PATCH v3] usb: core: Solve race condition in anchor cleanup functions
Date: Thu, 30 Jul 2020 13:46:41 +0200 [thread overview]
Message-ID: <1596109601.2508.4.camel@suse.de> (raw)
In-Reply-To: <20200730082338.23709-1-eli.billauer@gmail.com>
Am Donnerstag, den 30.07.2020, 11:23 +0300 schrieb
eli.billauer@gmail.com:
> From: Eli Billauer <eli.billauer@gmail.com>
>
Hi,
> The additional do-while loop relies on the new usb_anchor_safe_empty()
> function, which is like usb_anchor_check_wakeup(), only the former takes
> the anchor's lock before checking. Both functions return true iff the
> anchor list is empty, and there is no __usb_hcd_giveback_urb() in the
> system that is in the middle of the unanchor-before-complete phase.
> The @suspend_wakeups member of struct usb_anchor is used for this purpose,
> which was introduced to solve another problem which the same race
> condition causes, in commit 6ec4147e7bdb ("usb-anchor: Delay
> usb_wait_anchor_empty_timeout wake up till completion is done").
>
I think you can partially heed Alan's suggestion. The test takes
a lock you have just dropped. You need to drop it before you
call usb_kill_urb(), but the drop before the test is redundant.
Regards
Oliver
prev parent reply other threads:[~2020-07-30 11:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-30 8:23 [PATCH v3] usb: core: Solve race condition in anchor cleanup functions eli.billauer
2020-07-30 8:27 ` Eli Billauer
2020-07-30 11:46 ` 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=1596109601.2508.4.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).