[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1329298806-27623-1-git-send-email-yong.zhang0@gmail.com>
Date: Wed, 15 Feb 2012 17:40:06 +0800
From: Yong Zhang <yong.zhang0@...il.com>
To: linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Felipe Balbi <balbi@...com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: [PATCH] usb gadget: fix race between eth_open() and gen_ndis_set_resp()
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@...il.com>
Cc: Felipe Balbi <balbi@...com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists