提交 2e30168b 编写于 作者: D Daniel Drake 提交者: John W. Linville

libertas: terminate scan when stopping interface

There are currently no provisions in place to ensure that the scanning
task has been stopped when the interface is stopped or removed.

This can result in a WARNING at net/wireless/core.c:643 and other badness
when you remove the module while a scan is happening.

Terminate the scanning task during interface stop.
Signed-off-by: NDaniel Drake <dsd@laptop.org>
Acked-by: NDan Williams <dcbw@redhat.com>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 352ffad6
...@@ -700,8 +700,9 @@ static void lbs_scan_worker(struct work_struct *work) ...@@ -700,8 +700,9 @@ static void lbs_scan_worker(struct work_struct *work)
if (priv->scan_channel < priv->scan_req->n_channels) { if (priv->scan_channel < priv->scan_req->n_channels) {
cancel_delayed_work(&priv->scan_work); cancel_delayed_work(&priv->scan_work);
queue_delayed_work(priv->work_thread, &priv->scan_work, if (!priv->stopping)
msecs_to_jiffies(300)); queue_delayed_work(priv->work_thread, &priv->scan_work,
msecs_to_jiffies(300));
} }
/* This is the final data we are about to send */ /* This is the final data we are about to send */
......
...@@ -36,6 +36,7 @@ struct lbs_private { ...@@ -36,6 +36,7 @@ struct lbs_private {
/* CFG80211 */ /* CFG80211 */
struct wireless_dev *wdev; struct wireless_dev *wdev;
bool wiphy_registered; bool wiphy_registered;
bool stopping;
struct cfg80211_scan_request *scan_req; struct cfg80211_scan_request *scan_req;
u8 assoc_bss[ETH_ALEN]; u8 assoc_bss[ETH_ALEN];
u8 disassoc_reason; u8 disassoc_reason;
......
...@@ -104,6 +104,7 @@ static int lbs_dev_open(struct net_device *dev) ...@@ -104,6 +104,7 @@ static int lbs_dev_open(struct net_device *dev)
lbs_deb_enter(LBS_DEB_NET); lbs_deb_enter(LBS_DEB_NET);
spin_lock_irq(&priv->driver_lock); spin_lock_irq(&priv->driver_lock);
priv->stopping = false;
if (priv->connect_status == LBS_CONNECTED) if (priv->connect_status == LBS_CONNECTED)
netif_carrier_on(dev); netif_carrier_on(dev);
...@@ -131,10 +132,16 @@ static int lbs_eth_stop(struct net_device *dev) ...@@ -131,10 +132,16 @@ static int lbs_eth_stop(struct net_device *dev)
lbs_deb_enter(LBS_DEB_NET); lbs_deb_enter(LBS_DEB_NET);
spin_lock_irq(&priv->driver_lock); spin_lock_irq(&priv->driver_lock);
priv->stopping = true;
netif_stop_queue(dev); netif_stop_queue(dev);
spin_unlock_irq(&priv->driver_lock); spin_unlock_irq(&priv->driver_lock);
schedule_work(&priv->mcast_work); schedule_work(&priv->mcast_work);
cancel_delayed_work_sync(&priv->scan_work);
if (priv->scan_req) {
cfg80211_scan_done(priv->scan_req, false);
priv->scan_req = NULL;
}
lbs_deb_leave(LBS_DEB_NET); lbs_deb_leave(LBS_DEB_NET);
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册