Skip to content

Commit 20c62c7

Browse files
committed
Merge tag 'wireless-drivers-for-davem-2017-09-25' of git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers
Kalle Valo says: ==================== wireless-drivers fixes for 4.14 Quite a lot of fixes this time. Most notable is the brcmfmac fix for a CVE issue. iwlwifi * a couple of bugzilla bugs related to multicast handling * two fixes for WoWLAN bugs that were causing queue hangs and re-initialization problems * two fixes for potential uninitialized variable use reported by Dan Carpenter in relation to a recently introduced patch * a fix for buffer reordering in the newly supported 9000 device family * fix a race when starting aggregation * small fix for a recent patch to wake mac80211 queues * send non-bufferable management frames in the generic queue so they are not sent on queues that are under power-save ath10k * fix a PCI PM related gcc warning brcmfmac * CVE-2017-0786: add length check scan results from firmware * respect passive scan requests from user space qtnfmac * fix race in tx path when using multiple interfaces * cancel ongoing scan when removing the wireless interface ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 2760f5a + 3e747fa commit 20c62c7

File tree

17 files changed

+125
-46
lines changed

17 files changed

+125
-46
lines changed

drivers/net/wireless/ath/ath10k/pci.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3396,9 +3396,7 @@ static void ath10k_pci_remove(struct pci_dev *pdev)
33963396

33973397
MODULE_DEVICE_TABLE(pci, ath10k_pci_id_table);
33983398

3399-
#ifdef CONFIG_PM
3400-
3401-
static int ath10k_pci_pm_suspend(struct device *dev)
3399+
static __maybe_unused int ath10k_pci_pm_suspend(struct device *dev)
34023400
{
34033401
struct ath10k *ar = dev_get_drvdata(dev);
34043402
int ret;
@@ -3414,7 +3412,7 @@ static int ath10k_pci_pm_suspend(struct device *dev)
34143412
return ret;
34153413
}
34163414

3417-
static int ath10k_pci_pm_resume(struct device *dev)
3415+
static __maybe_unused int ath10k_pci_pm_resume(struct device *dev)
34183416
{
34193417
struct ath10k *ar = dev_get_drvdata(dev);
34203418
int ret;
@@ -3433,7 +3431,6 @@ static int ath10k_pci_pm_resume(struct device *dev)
34333431
static SIMPLE_DEV_PM_OPS(ath10k_pci_pm_ops,
34343432
ath10k_pci_pm_suspend,
34353433
ath10k_pci_pm_resume);
3436-
#endif
34373434

34383435
static struct pci_driver ath10k_pci_driver = {
34393436
.name = "ath10k_pci",

drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -980,20 +980,17 @@ static void brcmf_escan_prep(struct brcmf_cfg80211_info *cfg,
980980

981981
eth_broadcast_addr(params_le->bssid);
982982
params_le->bss_type = DOT11_BSSTYPE_ANY;
983-
params_le->scan_type = 0;
983+
params_le->scan_type = BRCMF_SCANTYPE_ACTIVE;
984984
params_le->channel_num = 0;
985985
params_le->nprobes = cpu_to_le32(-1);
986986
params_le->active_time = cpu_to_le32(-1);
987987
params_le->passive_time = cpu_to_le32(-1);
988988
params_le->home_time = cpu_to_le32(-1);
989989
memset(&params_le->ssid_le, 0, sizeof(params_le->ssid_le));
990990

991-
/* if request is null exit so it will be all channel broadcast scan */
992-
if (!request)
993-
return;
994-
995991
n_ssids = request->n_ssids;
996992
n_channels = request->n_channels;
993+
997994
/* Copy channel array if applicable */
998995
brcmf_dbg(SCAN, "### List of channelspecs to scan ### %d\n",
999996
n_channels);
@@ -1030,16 +1027,8 @@ static void brcmf_escan_prep(struct brcmf_cfg80211_info *cfg,
10301027
ptr += sizeof(ssid_le);
10311028
}
10321029
} else {
1033-
brcmf_dbg(SCAN, "Broadcast scan %p\n", request->ssids);
1034-
if ((request->ssids) && request->ssids->ssid_len) {
1035-
brcmf_dbg(SCAN, "SSID %s len=%d\n",
1036-
params_le->ssid_le.SSID,
1037-
request->ssids->ssid_len);
1038-
params_le->ssid_le.SSID_len =
1039-
cpu_to_le32(request->ssids->ssid_len);
1040-
memcpy(&params_le->ssid_le.SSID, request->ssids->ssid,
1041-
request->ssids->ssid_len);
1042-
}
1030+
brcmf_dbg(SCAN, "Performing passive scan\n");
1031+
params_le->scan_type = BRCMF_SCANTYPE_PASSIVE;
10431032
}
10441033
/* Adding mask to channel numbers */
10451034
params_le->channel_num =
@@ -3162,6 +3151,7 @@ brcmf_cfg80211_escan_handler(struct brcmf_if *ifp,
31623151
struct brcmf_cfg80211_info *cfg = ifp->drvr->config;
31633152
s32 status;
31643153
struct brcmf_escan_result_le *escan_result_le;
3154+
u32 escan_buflen;
31653155
struct brcmf_bss_info_le *bss_info_le;
31663156
struct brcmf_bss_info_le *bss = NULL;
31673157
u32 bi_length;
@@ -3181,11 +3171,23 @@ brcmf_cfg80211_escan_handler(struct brcmf_if *ifp,
31813171

31823172
if (status == BRCMF_E_STATUS_PARTIAL) {
31833173
brcmf_dbg(SCAN, "ESCAN Partial result\n");
3174+
if (e->datalen < sizeof(*escan_result_le)) {
3175+
brcmf_err("invalid event data length\n");
3176+
goto exit;
3177+
}
31843178
escan_result_le = (struct brcmf_escan_result_le *) data;
31853179
if (!escan_result_le) {
31863180
brcmf_err("Invalid escan result (NULL pointer)\n");
31873181
goto exit;
31883182
}
3183+
escan_buflen = le32_to_cpu(escan_result_le->buflen);
3184+
if (escan_buflen > BRCMF_ESCAN_BUF_SIZE ||
3185+
escan_buflen > e->datalen ||
3186+
escan_buflen < sizeof(*escan_result_le)) {
3187+
brcmf_err("Invalid escan buffer length: %d\n",
3188+
escan_buflen);
3189+
goto exit;
3190+
}
31893191
if (le16_to_cpu(escan_result_le->bss_count) != 1) {
31903192
brcmf_err("Invalid bss_count %d: ignoring\n",
31913193
escan_result_le->bss_count);
@@ -3202,9 +3204,8 @@ brcmf_cfg80211_escan_handler(struct brcmf_if *ifp,
32023204
}
32033205

32043206
bi_length = le32_to_cpu(bss_info_le->length);
3205-
if (bi_length != (le32_to_cpu(escan_result_le->buflen) -
3206-
WL_ESCAN_RESULTS_FIXED_SIZE)) {
3207-
brcmf_err("Invalid bss_info length %d: ignoring\n",
3207+
if (bi_length != escan_buflen - WL_ESCAN_RESULTS_FIXED_SIZE) {
3208+
brcmf_err("Ignoring invalid bss_info length: %d\n",
32083209
bi_length);
32093210
goto exit;
32103211
}

drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil_types.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@
4545
#define BRCMF_SCAN_PARAMS_COUNT_MASK 0x0000ffff
4646
#define BRCMF_SCAN_PARAMS_NSSID_SHIFT 16
4747

48+
/* scan type definitions */
49+
#define BRCMF_SCANTYPE_DEFAULT 0xFF
50+
#define BRCMF_SCANTYPE_ACTIVE 0
51+
#define BRCMF_SCANTYPE_PASSIVE 1
52+
4853
#define BRCMF_WSEC_MAX_PSK_LEN 32
4954
#define BRCMF_WSEC_PASSPHRASE BIT(0)
5055

drivers/net/wireless/intel/iwlwifi/mvm/d3.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2167,7 +2167,7 @@ static int __iwl_mvm_resume(struct iwl_mvm *mvm, bool test)
21672167
* 1. We are not using a unified image
21682168
* 2. We are using a unified image but had an error while exiting D3
21692169
*/
2170-
set_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status);
2170+
set_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED, &mvm->status);
21712171
set_bit(IWL_MVM_STATUS_D3_RECONFIG, &mvm->status);
21722172
/*
21732173
* When switching images we return 1, which causes mac80211

drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c

Lines changed: 59 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,6 +1546,11 @@ static void iwl_mvm_mc_iface_iterator(void *_data, u8 *mac,
15461546
struct iwl_mvm_mc_iter_data *data = _data;
15471547
struct iwl_mvm *mvm = data->mvm;
15481548
struct iwl_mcast_filter_cmd *cmd = mvm->mcast_filter_cmd;
1549+
struct iwl_host_cmd hcmd = {
1550+
.id = MCAST_FILTER_CMD,
1551+
.flags = CMD_ASYNC,
1552+
.dataflags[0] = IWL_HCMD_DFL_NOCOPY,
1553+
};
15491554
int ret, len;
15501555

15511556
/* if we don't have free ports, mcast frames will be dropped */
@@ -1560,7 +1565,10 @@ static void iwl_mvm_mc_iface_iterator(void *_data, u8 *mac,
15601565
memcpy(cmd->bssid, vif->bss_conf.bssid, ETH_ALEN);
15611566
len = roundup(sizeof(*cmd) + cmd->count * ETH_ALEN, 4);
15621567

1563-
ret = iwl_mvm_send_cmd_pdu(mvm, MCAST_FILTER_CMD, CMD_ASYNC, len, cmd);
1568+
hcmd.len[0] = len;
1569+
hcmd.data[0] = cmd;
1570+
1571+
ret = iwl_mvm_send_cmd(mvm, &hcmd);
15641572
if (ret)
15651573
IWL_ERR(mvm, "mcast filter cmd error. ret=%d\n", ret);
15661574
}
@@ -1635,6 +1643,12 @@ static void iwl_mvm_configure_filter(struct ieee80211_hw *hw,
16351643
if (!cmd)
16361644
goto out;
16371645

1646+
if (changed_flags & FIF_ALLMULTI)
1647+
cmd->pass_all = !!(*total_flags & FIF_ALLMULTI);
1648+
1649+
if (cmd->pass_all)
1650+
cmd->count = 0;
1651+
16381652
iwl_mvm_recalc_multicast(mvm);
16391653
out:
16401654
mutex_unlock(&mvm->mutex);
@@ -2563,7 +2577,7 @@ static void iwl_mvm_purge_deferred_tx_frames(struct iwl_mvm *mvm,
25632577
* queues, so we should never get a second deferred
25642578
* frame for the RA/TID.
25652579
*/
2566-
iwl_mvm_start_mac_queues(mvm, info->hw_queue);
2580+
iwl_mvm_start_mac_queues(mvm, BIT(info->hw_queue));
25672581
ieee80211_free_txskb(mvm->hw, skb);
25682582
}
25692583
}
@@ -3975,6 +3989,43 @@ static int iwl_mvm_post_channel_switch(struct ieee80211_hw *hw,
39753989
return ret;
39763990
}
39773991

3992+
static void iwl_mvm_flush_no_vif(struct iwl_mvm *mvm, u32 queues, bool drop)
3993+
{
3994+
if (drop) {
3995+
if (iwl_mvm_has_new_tx_api(mvm))
3996+
/* TODO new tx api */
3997+
WARN_ONCE(1,
3998+
"Need to implement flush TX queue\n");
3999+
else
4000+
iwl_mvm_flush_tx_path(mvm,
4001+
iwl_mvm_flushable_queues(mvm) & queues,
4002+
0);
4003+
} else {
4004+
if (iwl_mvm_has_new_tx_api(mvm)) {
4005+
struct ieee80211_sta *sta;
4006+
int i;
4007+
4008+
mutex_lock(&mvm->mutex);
4009+
4010+
for (i = 0; i < ARRAY_SIZE(mvm->fw_id_to_mac_id); i++) {
4011+
sta = rcu_dereference_protected(
4012+
mvm->fw_id_to_mac_id[i],
4013+
lockdep_is_held(&mvm->mutex));
4014+
if (IS_ERR_OR_NULL(sta))
4015+
continue;
4016+
4017+
iwl_mvm_wait_sta_queues_empty(mvm,
4018+
iwl_mvm_sta_from_mac80211(sta));
4019+
}
4020+
4021+
mutex_unlock(&mvm->mutex);
4022+
} else {
4023+
iwl_trans_wait_tx_queues_empty(mvm->trans,
4024+
queues);
4025+
}
4026+
}
4027+
}
4028+
39784029
static void iwl_mvm_mac_flush(struct ieee80211_hw *hw,
39794030
struct ieee80211_vif *vif, u32 queues, bool drop)
39804031
{
@@ -3985,7 +4036,12 @@ static void iwl_mvm_mac_flush(struct ieee80211_hw *hw,
39854036
int i;
39864037
u32 msk = 0;
39874038

3988-
if (!vif || vif->type != NL80211_IFTYPE_STATION)
4039+
if (!vif) {
4040+
iwl_mvm_flush_no_vif(mvm, queues, drop);
4041+
return;
4042+
}
4043+
4044+
if (vif->type != NL80211_IFTYPE_STATION)
39894045
return;
39904046

39914047
/* Make sure we're done with the deferred traffic before flushing */

drivers/net/wireless/intel/iwlwifi/mvm/rs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,8 @@ static void rs_tl_turn_on_agg(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta,
661661
(lq_sta->tx_agg_tid_en & BIT(tid)) &&
662662
(tid_data->tx_count_last >= IWL_MVM_RS_AGG_START_THRESHOLD)) {
663663
IWL_DEBUG_RATE(mvm, "try to aggregate tid %d\n", tid);
664-
rs_tl_turn_on_agg_for_tid(mvm, lq_sta, tid, sta);
664+
if (rs_tl_turn_on_agg_for_tid(mvm, lq_sta, tid, sta) == 0)
665+
tid_data->state = IWL_AGG_QUEUED;
665666
}
666667
}
667668

drivers/net/wireless/intel/iwlwifi/mvm/rxmq.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -672,11 +672,12 @@ static bool iwl_mvm_reorder(struct iwl_mvm *mvm,
672672
* If there was a significant jump in the nssn - adjust.
673673
* If the SN is smaller than the NSSN it might need to first go into
674674
* the reorder buffer, in which case we just release up to it and the
675-
* rest of the function will take of storing it and releasing up to the
676-
* nssn
675+
* rest of the function will take care of storing it and releasing up to
676+
* the nssn
677677
*/
678678
if (!iwl_mvm_is_sn_less(nssn, buffer->head_sn + buffer->buf_size,
679-
buffer->buf_size)) {
679+
buffer->buf_size) ||
680+
!ieee80211_sn_less(sn, buffer->head_sn + buffer->buf_size)) {
680681
u16 min_sn = ieee80211_sn_less(sn, nssn) ? sn : nssn;
681682

682683
iwl_mvm_release_frames(mvm, sta, napi, buffer, min_sn);

drivers/net/wireless/intel/iwlwifi/mvm/scan.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ static int iwl_mvm_lmac_scan_abort(struct iwl_mvm *mvm)
555555
struct iwl_host_cmd cmd = {
556556
.id = SCAN_OFFLOAD_ABORT_CMD,
557557
};
558-
u32 status;
558+
u32 status = CAN_ABORT_STATUS;
559559

560560
ret = iwl_mvm_send_cmd_status(mvm, &cmd, &status);
561561
if (ret)

drivers/net/wireless/intel/iwlwifi/mvm/sta.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1285,7 +1285,7 @@ static int iwl_mvm_add_int_sta_common(struct iwl_mvm *mvm,
12851285
{
12861286
struct iwl_mvm_add_sta_cmd cmd;
12871287
int ret;
1288-
u32 status;
1288+
u32 status = ADD_STA_SUCCESS;
12891289

12901290
lockdep_assert_held(&mvm->mutex);
12911291

@@ -2385,8 +2385,10 @@ int iwl_mvm_sta_tx_agg_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
23852385
if (WARN_ON_ONCE(tid >= IWL_MAX_TID_COUNT))
23862386
return -EINVAL;
23872387

2388-
if (mvmsta->tid_data[tid].state != IWL_AGG_OFF) {
2389-
IWL_ERR(mvm, "Start AGG when state is not IWL_AGG_OFF %d!\n",
2388+
if (mvmsta->tid_data[tid].state != IWL_AGG_QUEUED &&
2389+
mvmsta->tid_data[tid].state != IWL_AGG_OFF) {
2390+
IWL_ERR(mvm,
2391+
"Start AGG when state is not IWL_AGG_QUEUED or IWL_AGG_OFF %d!\n",
23902392
mvmsta->tid_data[tid].state);
23912393
return -ENXIO;
23922394
}

drivers/net/wireless/intel/iwlwifi/mvm/sta.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ struct iwl_mvm_vif;
281281
* These states relate to a specific RA / TID.
282282
*
283283
* @IWL_AGG_OFF: aggregation is not used
284+
* @IWL_AGG_QUEUED: aggregation start work has been queued
284285
* @IWL_AGG_STARTING: aggregation are starting (between start and oper)
285286
* @IWL_AGG_ON: aggregation session is up
286287
* @IWL_EMPTYING_HW_QUEUE_ADDBA: establishing a BA session - waiting for the
@@ -290,6 +291,7 @@ struct iwl_mvm_vif;
290291
*/
291292
enum iwl_mvm_agg_state {
292293
IWL_AGG_OFF = 0,
294+
IWL_AGG_QUEUED,
293295
IWL_AGG_STARTING,
294296
IWL_AGG_ON,
295297
IWL_EMPTYING_HW_QUEUE_ADDBA,

drivers/net/wireless/intel/iwlwifi/mvm/tt.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,7 @@ int iwl_mvm_ctdp_command(struct iwl_mvm *mvm, u32 op, u32 state)
529529

530530
lockdep_assert_held(&mvm->mutex);
531531

532+
status = 0;
532533
ret = iwl_mvm_send_cmd_pdu_status(mvm, WIDE_ID(PHY_OPS_GROUP,
533534
CTDP_CONFIG_CMD),
534535
sizeof(cmd), &cmd, &status);

drivers/net/wireless/intel/iwlwifi/mvm/tx.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -564,18 +564,18 @@ static int iwl_mvm_get_ctrl_vif_queue(struct iwl_mvm *mvm,
564564
case NL80211_IFTYPE_AP:
565565
case NL80211_IFTYPE_ADHOC:
566566
/*
567-
* Handle legacy hostapd as well, where station will be added
568-
* only just before sending the association response.
567+
* Non-bufferable frames use the broadcast station, thus they
568+
* use the probe queue.
569569
* Also take care of the case where we send a deauth to a
570570
* station that we don't have, or similarly an association
571571
* response (with non-success status) for a station we can't
572572
* accept.
573573
* Also, disassociate frames might happen, particular with
574574
* reason 7 ("Class 3 frame received from nonassociated STA").
575575
*/
576-
if (ieee80211_is_probe_resp(fc) || ieee80211_is_auth(fc) ||
577-
ieee80211_is_deauth(fc) || ieee80211_is_assoc_resp(fc) ||
578-
ieee80211_is_disassoc(fc))
576+
if (ieee80211_is_mgmt(fc) &&
577+
(!ieee80211_is_bufferable_mmpdu(fc) ||
578+
ieee80211_is_deauth(fc) || ieee80211_is_disassoc(fc)))
579579
return mvm->probe_queue;
580580
if (info->hw_queue == info->control.vif->cab_queue)
581581
return mvmvif->cab_queue;

drivers/net/wireless/quantenna/qtnfmac/cfg80211.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ int qtnf_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev)
115115

116116
vif = qtnf_netdev_get_priv(wdev->netdev);
117117

118+
qtnf_scan_done(vif->mac, true);
119+
118120
if (qtnf_cmd_send_del_intf(vif))
119121
pr_err("VIF%u.%u: failed to delete VIF\n", vif->mac->macid,
120122
vif->vifid);
@@ -335,6 +337,8 @@ static int qtnf_stop_ap(struct wiphy *wiphy, struct net_device *dev)
335337
struct qtnf_vif *vif = qtnf_netdev_get_priv(dev);
336338
int ret;
337339

340+
qtnf_scan_done(vif->mac, true);
341+
338342
ret = qtnf_cmd_send_stop_ap(vif);
339343
if (ret) {
340344
pr_err("VIF%u.%u: failed to stop AP operation in FW\n",
@@ -570,8 +574,6 @@ qtnf_del_station(struct wiphy *wiphy, struct net_device *dev,
570574
!qtnf_sta_list_lookup(&vif->sta_list, params->mac))
571575
return 0;
572576

573-
qtnf_scan_done(vif->mac, true);
574-
575577
ret = qtnf_cmd_send_del_sta(vif, params);
576578
if (ret)
577579
pr_err("VIF%u.%u: failed to delete STA %pM\n",
@@ -1134,8 +1136,9 @@ void qtnf_virtual_intf_cleanup(struct net_device *ndev)
11341136
}
11351137

11361138
vif->sta_state = QTNF_STA_DISCONNECTED;
1137-
qtnf_scan_done(mac, true);
11381139
}
1140+
1141+
qtnf_scan_done(mac, true);
11391142
}
11401143

11411144
void qtnf_cfg80211_vif_reset(struct qtnf_vif *vif)

drivers/net/wireless/quantenna/qtnfmac/cfg80211.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ static inline void qtnf_scan_done(struct qtnf_wmac *mac, bool aborted)
3434
.aborted = aborted,
3535
};
3636

37+
if (timer_pending(&mac->scan_timeout))
38+
del_timer_sync(&mac->scan_timeout);
39+
3740
mutex_lock(&mac->mac_lock);
3841

3942
if (mac->scan_req) {

0 commit comments

Comments
 (0)