[PATCH] usb gadget: fix race between eth_open() and gen_ndis_set_resp()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
Cc: Felipe Balbi <balbi@xxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 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-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux