Commit 6fd1eace authored by Kalle Valo's avatar Kalle Valo

ath6kl: fix crash when interface is closed but scan is ongoing

When ath6kl module was removed while a scan was ongoing the driver would
crash in ath6kl_cfg80211_scan_complete_event().

Fix the function not to iterate nodes when the scan is aborted. The nodes
are already freed when the module is being unloaded. This patch removes the
null check entirely as the wmi structure is not accessed anymore during
module unload.

Also fix a bug where the status was checked as a bitfield with '&' operator.
But it's not a bitfield, just a regular error code.

This is a port of my patch from ath6kl staging with the same title.
Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
parent cf104c2a
...@@ -820,29 +820,34 @@ static int ath6kl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev, ...@@ -820,29 +820,34 @@ static int ath6kl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
void ath6kl_cfg80211_scan_complete_event(struct ath6kl *ar, int status) void ath6kl_cfg80211_scan_complete_event(struct ath6kl *ar, int status)
{ {
int i;
ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: status %d\n", __func__, status); ath6kl_dbg(ATH6KL_DBG_WLAN_CFG, "%s: status %d\n", __func__, status);
if (ar->scan_req) { if (!ar->scan_req)
/* Translate data to cfg80211 mgmt format */ return;
ath6kl_wmi_iterate_nodes(ar->wmi, ath6kl_cfg80211_scan_node,
ar->wdev->wiphy); if ((status == -ECANCELED) || (status == -EBUSY)) {
cfg80211_scan_done(ar->scan_req, true);
cfg80211_scan_done(ar->scan_req, ((status & -ECANCELED) goto out;
|| (status & -EBUSY)) ? true : }
false);
/* Translate data to cfg80211 mgmt format */
if (ar->scan_req->n_ssids && ar->scan_req->ssids[0].ssid_len) { ath6kl_wmi_iterate_nodes(ar->wmi, ath6kl_cfg80211_scan_node,
u8 i; ar->wdev->wiphy);
for (i = 0; i < ar->scan_req->n_ssids; i++) { cfg80211_scan_done(ar->scan_req, false);
ath6kl_wmi_probedssid_cmd(ar->wmi, i + 1,
DISABLE_SSID_FLAG, if (ar->scan_req->n_ssids && ar->scan_req->ssids[0].ssid_len) {
0, NULL); for (i = 0; i < ar->scan_req->n_ssids; i++) {
} ath6kl_wmi_probedssid_cmd(ar->wmi, i + 1,
DISABLE_SSID_FLAG,
0, NULL);
} }
ar->scan_req = NULL;
} }
out:
ar->scan_req = NULL;
} }
static int ath6kl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev, static int ath6kl_cfg80211_add_key(struct wiphy *wiphy, struct net_device *ndev,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment