netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
To: Alan Stern <stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org>
Cc: Oliver Neukum <oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org>,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] net/usbnet: avoid recursive locking in usbnet_stop()
Date: Mon, 20 Feb 2012 22:02:28 +0100	[thread overview]
Message-ID: <4F42B4E4.5090100@linutronix.de> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1202201524290.11040-100000-pYrvlCTfrz9XsRXLowluHWD2FQJk+8+b@public.gmane.org>

On 02/20/2012 09:31 PM, Alan Stern wrote:
> On Mon, 20 Feb 2012, Sebastian Andrzej Siewior wrote:
>
>> On 02/20/2012 05:21 PM, Oliver Neukum wrote:
>>>> defer_bh() takes the lok which is hold during unlink_urbs(). The safe
>>>> walk suggest that the skb will be removed from the list and this is done
>>>> by defer_bh() so it seems to be okay to drop the lock here.
>>>
>>> I am afraid there's something wrong in the hcd driver. Async unlink must
>>> be possible with a lock held. I cannot approve this patch.
>>
>> Hmmm. The comment above unlink() says that. Looking through other hcds
>> it seems that musb is not the only one doing it wrong. Oh well...
>
> What's the issue here?
>
> If a driver calls usb_unlink_urb() while holding a lock, and the
> completion routine tries to acquire the same lock, then deadlock is
> possible.  The fact that usb_unlink_urb() is asynchronous is not a
> guarantee of anything; the HCD is allowed to call the completion
> handler from within usb_unlink_urb().
>
> It's true that the kerneldoc for usb_unlink_urb() says "This request is
> always asynchronous".  It might be a good idea to remove the word
> "always", because it seems to give people the wrong idea.

I see. So you approve that patch and suggest to remove the "always"
wording plus adding something like "the hcd might call complete routine
during unlink" ?

>
> Alan Stern
>

Sebastian
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2012-02-20 21:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-20 16:01 [PATCH] net/usbnet: avoid recursive locking in usbnet_stop() Sebastian Andrzej Siewior
2012-02-20 16:21 ` Oliver Neukum
     [not found]   ` <201202201721.38136.oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org>
2012-02-20 16:42     ` Sebastian Andrzej Siewior
     [not found]       ` <4F4277DD.3090204-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
2012-02-20 20:31         ` Alan Stern
     [not found]           ` <Pine.LNX.4.44L0.1202201524290.11040-100000-pYrvlCTfrz9XsRXLowluHWD2FQJk+8+b@public.gmane.org>
2012-02-20 21:02             ` Sebastian Andrzej Siewior [this message]
     [not found]               ` <4F42B4E4.5090100-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
2012-02-20 21:40                 ` Alan Stern
     [not found]                   ` <Pine.LNX.4.44L0.1202201638330.13111-100000-pYrvlCTfrz9XsRXLowluHWD2FQJk+8+b@public.gmane.org>
2012-02-22 19:45                     ` [PATCH] usb/core: remove "always" from usb_unlink_urb() kernel doc entry Sebastian Andrzej Siewior
     [not found]                       ` <20120222194510.GA6964-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
2012-02-22 20:28                         ` Alan Stern
     [not found]                           ` <Pine.LNX.4.44L0.1202221525210.1311-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2012-02-29 22:04                             ` [PATCH v2] " Sebastian Andrzej Siewior
2012-03-05 21:25     ` [PATCH] net/usbnet: avoid recursive locking in usbnet_stop() Sebastian Andrzej Siewior
2012-03-05 21:40       ` David Miller

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=4F42B4E4.5090100@linutronix.de \
    --to=bigeasy-hfztesqfncyowbw4kg4ksq@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=oliver-GvhC2dPhHPQdnm+yROfE0A@public.gmane.org \
    --cc=stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org \
    /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).