aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Andryuk <jandryuk@gmail.com>2009-02-21 02:53:14 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-02-27 14:53:00 -0500
commitdeda862e699f0aba6f0975e138a0258d1b29f2df (patch)
treefa13583ac379d8837012cd65c59ca0b14b14a4aa
parent2f92cd2e5f1751f7da5fa9b58e0ab22da6577cfd (diff)
at76c50x-usb: fix oops on disconnect
flush_workqueue needs to be called instead of the generic one and the associated functions need to be modified to prevent re-adding themselves to the workqueue. The rx_tasklet is also killed in the small (?) chance it is scheduled. Signed-off-by: Jason Andryuk <jandryuk@gmail.com> Signed-off-by: Kalle Valo <kalle.valo@iki.fi> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/at76c50x-usb.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/drivers/net/wireless/at76c50x-usb.c b/drivers/net/wireless/at76c50x-usb.c
index aa06b90664d3..c79591ee2055 100644
--- a/drivers/net/wireless/at76c50x-usb.c
+++ b/drivers/net/wireless/at76c50x-usb.c
@@ -1848,6 +1848,9 @@ static void at76_dwork_hw_scan(struct work_struct *work)
1848 dwork_hw_scan.work); 1848 dwork_hw_scan.work);
1849 int ret; 1849 int ret;
1850 1850
1851 if (priv->device_unplugged)
1852 return;
1853
1851 mutex_lock(&priv->mtx); 1854 mutex_lock(&priv->mtx);
1852 1855
1853 ret = at76_get_cmd_status(priv->udev, CMD_SCAN); 1856 ret = at76_get_cmd_status(priv->udev, CMD_SCAN);
@@ -1882,6 +1885,9 @@ static int at76_hw_scan(struct ieee80211_hw *hw,
1882 1885
1883 at76_dbg(DBG_MAC80211, "%s():", __func__); 1886 at76_dbg(DBG_MAC80211, "%s():", __func__);
1884 1887
1888 if (priv->device_unplugged)
1889 return 0;
1890
1885 mutex_lock(&priv->mtx); 1891 mutex_lock(&priv->mtx);
1886 1892
1887 ieee80211_stop_queues(hw); 1893 ieee80211_stop_queues(hw);
@@ -1985,6 +1991,10 @@ static void at76_configure_filter(struct ieee80211_hw *hw,
1985 flags = changed_flags & AT76_SUPPORTED_FILTERS; 1991 flags = changed_flags & AT76_SUPPORTED_FILTERS;
1986 *total_flags = AT76_SUPPORTED_FILTERS; 1992 *total_flags = AT76_SUPPORTED_FILTERS;
1987 1993
1994 /* Bail out after updating flags to prevent a WARN_ON in mac80211. */
1995 if (priv->device_unplugged)
1996 return;
1997
1988 /* FIXME: access to priv->promisc should be protected with 1998 /* FIXME: access to priv->promisc should be protected with
1989 * priv->mtx, but it's impossible because this function needs to be 1999 * priv->mtx, but it's impossible because this function needs to be
1990 * atomic */ 2000 * atomic */
@@ -2085,8 +2095,7 @@ static struct at76_priv *at76_alloc_new_device(struct usb_device *udev)
2085 INIT_WORK(&priv->work_submit_rx, at76_work_submit_rx); 2095 INIT_WORK(&priv->work_submit_rx, at76_work_submit_rx);
2086 INIT_DELAYED_WORK(&priv->dwork_hw_scan, at76_dwork_hw_scan); 2096 INIT_DELAYED_WORK(&priv->dwork_hw_scan, at76_dwork_hw_scan);
2087 2097
2088 priv->rx_tasklet.func = at76_rx_tasklet; 2098 tasklet_init(&priv->rx_tasklet, at76_rx_tasklet, 0);
2089 priv->rx_tasklet.data = 0;
2090 2099
2091 priv->pm_mode = AT76_PM_OFF; 2100 priv->pm_mode = AT76_PM_OFF;
2092 priv->pm_period = 0; 2101 priv->pm_period = 0;
@@ -2225,6 +2234,7 @@ static int at76_init_new_device(struct at76_priv *priv,
2225 priv->scan_min_time = DEF_SCAN_MIN_TIME; 2234 priv->scan_min_time = DEF_SCAN_MIN_TIME;
2226 priv->scan_max_time = DEF_SCAN_MAX_TIME; 2235 priv->scan_max_time = DEF_SCAN_MAX_TIME;
2227 priv->scan_mode = SCAN_TYPE_ACTIVE; 2236 priv->scan_mode = SCAN_TYPE_ACTIVE;
2237 priv->device_unplugged = 0;
2228 2238
2229 /* mac80211 initialisation */ 2239 /* mac80211 initialisation */
2230 priv->hw->wiphy->max_scan_ssids = 1; 2240 priv->hw->wiphy->max_scan_ssids = 1;
@@ -2266,13 +2276,12 @@ static void at76_delete_device(struct at76_priv *priv)
2266 /* The device is gone, don't bother turning it off */ 2276 /* The device is gone, don't bother turning it off */
2267 priv->device_unplugged = 1; 2277 priv->device_unplugged = 1;
2268 2278
2269 if (priv->mac80211_registered) 2279 tasklet_kill(&priv->rx_tasklet);
2270 ieee80211_unregister_hw(priv->hw);
2271 2280
2272 /* assuming we used keventd, it must quiesce too */ 2281 if (priv->mac80211_registered) {
2273 flush_scheduled_work(); 2282 flush_workqueue(priv->hw->workqueue);
2274 2283 ieee80211_unregister_hw(priv->hw);
2275 kfree(priv->bulk_out_buffer); 2284 }
2276 2285
2277 if (priv->tx_urb) { 2286 if (priv->tx_urb) {
2278 usb_kill_urb(priv->tx_urb); 2287 usb_kill_urb(priv->tx_urb);
@@ -2285,6 +2294,8 @@ static void at76_delete_device(struct at76_priv *priv)
2285 2294
2286 at76_dbg(DBG_PROC_ENTRY, "%s: unlinked urbs", __func__); 2295 at76_dbg(DBG_PROC_ENTRY, "%s: unlinked urbs", __func__);
2287 2296
2297 kfree(priv->bulk_out_buffer);
2298
2288 if (priv->rx_skb) 2299 if (priv->rx_skb)
2289 kfree_skb(priv->rx_skb); 2300 kfree_skb(priv->rx_skb);
2290 2301