lkml.org 
[lkml]   [2012]   [Feb]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] usb gadget: fix race between eth_open() and gen_ndis_set_resp()
Date
In such a scenario:
static int gen_ndis_set_resp()
{
...
switch (OID) {
case OID_GEN_CURRENT_PACKET_FILTER:
...
if (*params->filter) {
...
} else {
params->state = RNDIS_INITIALIZED;
netif_carrier_off(params->dev);
netif_stop_queue(params->dev); <=== A
}
}

After A is finished, if someone call 'ifconfig usb0 *.*.*.*',
usb0 will never go up because eth_open() fail to call eth_start();

Fix it by calling eth_start() unconditionally in eth_open().

Signed-off-by: Yong Zhang <yong.zhang0@gmail.com>
Cc: Felipe Balbi <balbi@ti.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/gadget/u_ether.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/u_ether.c b/drivers/usb/gadget/u_ether.c
index 29c854b..a1a666f 100644
--- a/drivers/usb/gadget/u_ether.c
+++ b/drivers/usb/gadget/u_ether.c
@@ -640,8 +640,7 @@ static int eth_open(struct net_device *net)
struct gether *link;

DBG(dev, "%s\n", __func__);
- if (netif_carrier_ok(dev->net))
- eth_start(dev, GFP_KERNEL);
+ eth_start(dev, GFP_KERNEL);

spin_lock_irq(&dev->lock);
link = dev->port_usb;
--
1.7.5.4


\
 
 \ /
  Last update: 2012-02-15 10:43    [W:0.021 / U:0.244 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site