aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rndis_wlan.c
diff options
context:
space:
mode:
authorJussi Kivilinna <jussi.kivilinna@mbnet.fi>2009-04-22 03:59:37 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-04-28 15:59:48 -0400
commite805e4d0b53506dff4255a2792483f094e7fcd2c (patch)
tree7f2edb53b21900d1cc857df1b0d93ded9e19d9e3 /drivers/net/wireless/rndis_wlan.c
parent6269b731560d69c5eaa929909891edec39496d71 (diff)
rndis_wlan: fix initialization order for workqueue&workers
rndis_wext_link_change() might be called from rndis_command() at initialization stage and priv->workqueue/priv->work have not been initialized yet. This causes invalid opcode at rndis_wext_bind on some brands of bcm4320. Fix by initializing workqueue/workers in rndis_wext_bind() before rndis_command is used. This bug has existed since 2.6.25, reported at: http://bugzilla.kernel.org/show_bug.cgi?id=12794 Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rndis_wlan.c')
-rw-r--r--drivers/net/wireless/rndis_wlan.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/net/wireless/rndis_wlan.c b/drivers/net/wireless/rndis_wlan.c
index db91db776508..bebf735cd4bd 100644
--- a/drivers/net/wireless/rndis_wlan.c
+++ b/drivers/net/wireless/rndis_wlan.c
@@ -2558,6 +2558,11 @@ static int rndis_wext_bind(struct usbnet *usbdev, struct usb_interface *intf)
2558 mutex_init(&priv->command_lock); 2558 mutex_init(&priv->command_lock);
2559 spin_lock_init(&priv->stats_lock); 2559 spin_lock_init(&priv->stats_lock);
2560 2560
2561 /* because rndis_command() sleeps we need to use workqueue */
2562 priv->workqueue = create_singlethread_workqueue("rndis_wlan");
2563 INIT_WORK(&priv->work, rndis_wext_worker);
2564 INIT_DELAYED_WORK(&priv->stats_work, rndis_update_wireless_stats);
2565
2561 /* try bind rndis_host */ 2566 /* try bind rndis_host */
2562 retval = generic_rndis_bind(usbdev, intf, FLAG_RNDIS_PHYM_WIRELESS); 2567 retval = generic_rndis_bind(usbdev, intf, FLAG_RNDIS_PHYM_WIRELESS);
2563 if (retval < 0) 2568 if (retval < 0)
@@ -2603,16 +2608,17 @@ static int rndis_wext_bind(struct usbnet *usbdev, struct usb_interface *intf)
2603 disassociate(usbdev, 1); 2608 disassociate(usbdev, 1);
2604 netif_carrier_off(usbdev->net); 2609 netif_carrier_off(usbdev->net);
2605 2610
2606 /* because rndis_command() sleeps we need to use workqueue */
2607 priv->workqueue = create_singlethread_workqueue("rndis_wlan");
2608 INIT_DELAYED_WORK(&priv->stats_work, rndis_update_wireless_stats);
2609 queue_delayed_work(priv->workqueue, &priv->stats_work, 2611 queue_delayed_work(priv->workqueue, &priv->stats_work,
2610 round_jiffies_relative(STATS_UPDATE_JIFFIES)); 2612 round_jiffies_relative(STATS_UPDATE_JIFFIES));
2611 INIT_WORK(&priv->work, rndis_wext_worker);
2612 2613
2613 return 0; 2614 return 0;
2614 2615
2615fail: 2616fail:
2617 cancel_delayed_work_sync(&priv->stats_work);
2618 cancel_work_sync(&priv->work);
2619 flush_workqueue(priv->workqueue);
2620 destroy_workqueue(priv->workqueue);
2621
2616 kfree(priv); 2622 kfree(priv);
2617 return retval; 2623 return retval;
2618} 2624}