]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
qtnfmac: cleanup wdev structure between its uses
authorSergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Tue, 29 May 2018 12:00:00 +0000 (15:00 +0300)
committerKalle Valo <kvalo@codeaurora.org>
Wed, 30 May 2018 19:20:05 +0000 (22:20 +0300)
Driver uses statically allocated wdev structures for each virtual
interface. However wdev structure is not properly cleaned up between
its uses. As a result, various bugs appear when userspace tools
like hostapd were not gracefully stopped.

In particular, this commit fixes the following issue:
- start hostapd with more than 2 mBSS
- kill hostapd using SIGKILL
- start again hostapd with more than 2 mBSS
However only two mBSS entities will be started: primary
and the last BSS listed in hostapd config.

Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/quantenna/qtnfmac/cfg80211.c
drivers/net/wireless/quantenna/qtnfmac/core.c

index bf624d975953fb4c1f0e19667020ab3716f7c735..2089cb0952835c27fa97c5b7660a2ce083b99a7a 100644 (file)
@@ -177,8 +177,6 @@ int qtnf_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev)
        vif->netdev->ieee80211_ptr = NULL;
        vif->netdev = NULL;
        vif->wdev.iftype = NL80211_IFTYPE_UNSPECIFIED;
-       eth_zero_addr(vif->mac_addr);
-       eth_zero_addr(vif->bssid);
 
        return 0;
 }
@@ -216,10 +214,12 @@ static struct wireless_dev *qtnf_add_virtual_intf(struct wiphy *wiphy,
                }
 
                eth_zero_addr(vif->mac_addr);
+               eth_zero_addr(vif->bssid);
                vif->bss_priority = QTNF_DEF_BSS_PRIORITY;
+               vif->sta_state = QTNF_STA_DISCONNECTED;
+               memset(&vif->wdev, 0, sizeof(vif->wdev));
                vif->wdev.wiphy = wiphy;
                vif->wdev.iftype = type;
-               vif->sta_state = QTNF_STA_DISCONNECTED;
                break;
        default:
                pr_err("MAC%u: unsupported IF type %d\n", mac->macid, type);
@@ -255,8 +255,6 @@ static struct wireless_dev *qtnf_add_virtual_intf(struct wiphy *wiphy,
        qtnf_cmd_send_del_intf(vif);
 err_cmd:
        vif->wdev.iftype = NL80211_IFTYPE_UNSPECIFIED;
-       eth_zero_addr(vif->mac_addr);
-       eth_zero_addr(vif->bssid);
 
        return ERR_PTR(-EFAULT);
 }
index b3bfb4faa9186b2251bc84e9016e5c42e326993f..3ccbc427cf56c04e5933bad8814c9bd2c1da26b0 100644 (file)
@@ -394,7 +394,6 @@ int qtnf_core_net_attach(struct qtnf_wmac *mac, struct qtnf_vif *vif,
        dev = alloc_netdev_mqs(sizeof(struct qtnf_vif *), name,
                               name_assign_type, ether_setup, 1, 1);
        if (!dev) {
-               memset(&vif->wdev, 0, sizeof(vif->wdev));
                vif->wdev.iftype = NL80211_IFTYPE_UNSPECIFIED;
                return -ENOMEM;
        }