Netdev List
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Li RongQing <roy.qing.li@gmail.com>
Cc: netdev <netdev@vger.kernel.org>,
	linux-usb@vger.kernel.org, jeff.westfahl@ni.com
Subject: Re: [BUG] Lockdep splat in usb network gadget
Date: Wed, 23 Jul 2014 11:11:14 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.10.1407231110490.23352@nanos> (raw)
In-Reply-To: <CAJFZqHys3KUxBBaV18Gb3h-R7tQQpZJyh92dR1tyNizgoT5=UQ@mail.gmail.com>

On Wed, 23 Jul 2014, Li RongQing wrote:

> This commit introduced this bug
> 
> commit a9232076374334ca2bc2a448dfde96d38a54349a
> Author: Jeff Westfahl <jeff.westfahl@ni.com>
> Date:   Thu May 29 09:49:41 2014 +0300
> 
>     usb: gadget: u_ether: synchronize with transmit when stopping queue
> 
>     When disconnecting, it's possible that another thread has already made it
>     into eth_start_xmit before we call netif_stop_queue. This can lead to a
>     crash as eth_start_xmit tries to use resources that gether_disconnect is
>     freeing. Use netif_tx_lock/unlock around netif_stop_queue to ensure no
>     threads are executing during the remainder of gether_disconnect.
> 
>     Signed-off-by: Jeff Westfahl <jeff.westfahl@ni.com>
>     Tested-by: Jaeden Amero <jaeden.amero@ni.com>
>     Signed-off-by: Felipe Balbi <balbi@ti.com>

So what's the fix?
 
> diff --git a/drivers/usb/gadget/u_ether.c b/drivers/usb/gadget/u_ether.c
> index 3d78a88..97b0277 100644
> --- a/drivers/usb/gadget/u_ether.c
> +++ b/drivers/usb/gadget/u_ether.c
> @@ -1120,7 +1120,10 @@ void gether_disconnect(struct gether *link)
> 
>         DBG(dev, "%s\n", __func__);
> 
> +       netif_tx_lock(dev->net);
>         netif_stop_queue(dev->net);
> +       netif_tx_unlock(dev->net);
> +
>         netif_carrier_off(dev->net);

  reply	other threads:[~2014-07-23  9:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-18 14:04 [BUG] Lockdep splat in usb network gadget Thomas Gleixner
2014-07-23  7:17 ` Li RongQing
2014-07-23  9:11   ` Thomas Gleixner [this message]
2014-07-23  9:21     ` Li RongQing

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=alpine.DEB.2.10.1407231110490.23352@nanos \
    --to=tglx@linutronix.de \
    --cc=jeff.westfahl@ni.com \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=roy.qing.li@gmail.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