Skip to content

Commit 9837ec9

Browse files
committed
Merge tag 'wireless-next-2022-09-03' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless-next
Johannes Berg says: ==================== drivers - rtw89: large update across the map, e.g. coex, pci(e), etc. - ath9k: uninit memory read fix - ath10k: small peer map fix and a WCN3990 device fix - wfx: underflow stack - the "change MAC address while IFF_UP" change from James we discussed - more MLO work, including a set of fixes for the previous code, now that we have more code we can exercise it more - prevent some features with MLO that aren't ready yet (AP_VLAN and 4-address connections) ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents aa3fab0 + c087f9f commit 9837ec9

File tree

71 files changed

+30752
-11171
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+30752
-11171
lines changed

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
9898
.tx_stats_over_pktlog = true,
9999
.dynamic_sar_support = false,
100100
.hw_restart_disconnect = false,
101+
.use_fw_tx_credits = true,
101102
},
102103
{
103104
.id = QCA988X_HW_2_0_VERSION,
@@ -136,6 +137,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
136137
.tx_stats_over_pktlog = true,
137138
.dynamic_sar_support = false,
138139
.hw_restart_disconnect = false,
140+
.use_fw_tx_credits = true,
139141
},
140142
{
141143
.id = QCA9887_HW_1_0_VERSION,
@@ -175,6 +177,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
175177
.tx_stats_over_pktlog = false,
176178
.dynamic_sar_support = false,
177179
.hw_restart_disconnect = false,
180+
.use_fw_tx_credits = true,
178181
},
179182
{
180183
.id = QCA6174_HW_3_2_VERSION,
@@ -209,6 +212,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
209212
.supports_peer_stats_info = true,
210213
.dynamic_sar_support = true,
211214
.hw_restart_disconnect = false,
215+
.use_fw_tx_credits = true,
212216
},
213217
{
214218
.id = QCA6174_HW_2_1_VERSION,
@@ -247,6 +251,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
247251
.tx_stats_over_pktlog = false,
248252
.dynamic_sar_support = false,
249253
.hw_restart_disconnect = false,
254+
.use_fw_tx_credits = true,
250255
},
251256
{
252257
.id = QCA6174_HW_2_1_VERSION,
@@ -285,6 +290,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
285290
.tx_stats_over_pktlog = false,
286291
.dynamic_sar_support = false,
287292
.hw_restart_disconnect = false,
293+
.use_fw_tx_credits = true,
288294
},
289295
{
290296
.id = QCA6174_HW_3_0_VERSION,
@@ -323,6 +329,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
323329
.tx_stats_over_pktlog = false,
324330
.dynamic_sar_support = false,
325331
.hw_restart_disconnect = false,
332+
.use_fw_tx_credits = true,
326333
},
327334
{
328335
.id = QCA6174_HW_3_2_VERSION,
@@ -365,6 +372,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
365372
.supports_peer_stats_info = true,
366373
.dynamic_sar_support = true,
367374
.hw_restart_disconnect = false,
375+
.use_fw_tx_credits = true,
368376
},
369377
{
370378
.id = QCA99X0_HW_2_0_DEV_VERSION,
@@ -409,6 +417,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
409417
.tx_stats_over_pktlog = false,
410418
.dynamic_sar_support = false,
411419
.hw_restart_disconnect = false,
420+
.use_fw_tx_credits = true,
412421
},
413422
{
414423
.id = QCA9984_HW_1_0_DEV_VERSION,
@@ -460,6 +469,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
460469
.tx_stats_over_pktlog = false,
461470
.dynamic_sar_support = false,
462471
.hw_restart_disconnect = false,
472+
.use_fw_tx_credits = true,
463473
},
464474
{
465475
.id = QCA9888_HW_2_0_DEV_VERSION,
@@ -508,6 +518,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
508518
.tx_stats_over_pktlog = false,
509519
.dynamic_sar_support = false,
510520
.hw_restart_disconnect = false,
521+
.use_fw_tx_credits = true,
511522
},
512523
{
513524
.id = QCA9377_HW_1_0_DEV_VERSION,
@@ -546,6 +557,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
546557
.tx_stats_over_pktlog = false,
547558
.dynamic_sar_support = false,
548559
.hw_restart_disconnect = false,
560+
.use_fw_tx_credits = true,
549561
},
550562
{
551563
.id = QCA9377_HW_1_1_DEV_VERSION,
@@ -586,6 +598,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
586598
.tx_stats_over_pktlog = false,
587599
.dynamic_sar_support = false,
588600
.hw_restart_disconnect = false,
601+
.use_fw_tx_credits = true,
589602
},
590603
{
591604
.id = QCA9377_HW_1_1_DEV_VERSION,
@@ -617,6 +630,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
617630
.credit_size_workaround = true,
618631
.dynamic_sar_support = false,
619632
.hw_restart_disconnect = false,
633+
.use_fw_tx_credits = true,
620634
},
621635
{
622636
.id = QCA4019_HW_1_0_DEV_VERSION,
@@ -662,6 +676,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
662676
.tx_stats_over_pktlog = false,
663677
.dynamic_sar_support = false,
664678
.hw_restart_disconnect = false,
679+
.use_fw_tx_credits = true,
665680
},
666681
{
667682
.id = WCN3990_HW_1_0_DEV_VERSION,
@@ -693,6 +708,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = {
693708
.tx_stats_over_pktlog = false,
694709
.dynamic_sar_support = true,
695710
.hw_restart_disconnect = true,
711+
.use_fw_tx_credits = false,
696712
},
697713
};
698714

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

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -947,13 +947,18 @@ int ath10k_htc_wait_target(struct ath10k_htc *htc)
947947
return -ECOMM;
948948
}
949949

950-
htc->total_transmit_credits = __le16_to_cpu(msg->ready.credit_count);
950+
if (ar->hw_params.use_fw_tx_credits)
951+
htc->total_transmit_credits = __le16_to_cpu(msg->ready.credit_count);
952+
else
953+
htc->total_transmit_credits = 1;
954+
951955
htc->target_credit_size = __le16_to_cpu(msg->ready.credit_size);
952956

953957
ath10k_dbg(ar, ATH10K_DBG_HTC,
954-
"Target ready! transmit resources: %d size:%d\n",
958+
"Target ready! transmit resources: %d size:%d actual credits:%d\n",
955959
htc->total_transmit_credits,
956-
htc->target_credit_size);
960+
htc->target_credit_size,
961+
msg->ready.credit_count);
957962

958963
if ((htc->total_transmit_credits == 0) ||
959964
(htc->target_credit_size == 0)) {

drivers/net/wireless/ath/ath10k/hw.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,6 +635,8 @@ struct ath10k_hw_params {
635635
bool dynamic_sar_support;
636636

637637
bool hw_restart_disconnect;
638+
639+
bool use_fw_tx_credits;
638640
};
639641

640642
struct htt_resp;

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

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -864,11 +864,36 @@ static int ath10k_peer_delete(struct ath10k *ar, u32 vdev_id, const u8 *addr)
864864
return 0;
865865
}
866866

867+
static void ath10k_peer_map_cleanup(struct ath10k *ar, struct ath10k_peer *peer)
868+
{
869+
int peer_id, i;
870+
871+
lockdep_assert_held(&ar->conf_mutex);
872+
873+
for_each_set_bit(peer_id, peer->peer_ids,
874+
ATH10K_MAX_NUM_PEER_IDS) {
875+
ar->peer_map[peer_id] = NULL;
876+
}
877+
878+
/* Double check that peer is properly un-referenced from
879+
* the peer_map
880+
*/
881+
for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) {
882+
if (ar->peer_map[i] == peer) {
883+
ath10k_warn(ar, "removing stale peer_map entry for %pM (ptr %pK idx %d)\n",
884+
peer->addr, peer, i);
885+
ar->peer_map[i] = NULL;
886+
}
887+
}
888+
889+
list_del(&peer->list);
890+
kfree(peer);
891+
ar->num_peers--;
892+
}
893+
867894
static void ath10k_peer_cleanup(struct ath10k *ar, u32 vdev_id)
868895
{
869896
struct ath10k_peer *peer, *tmp;
870-
int peer_id;
871-
int i;
872897

873898
lockdep_assert_held(&ar->conf_mutex);
874899

@@ -880,25 +905,7 @@ static void ath10k_peer_cleanup(struct ath10k *ar, u32 vdev_id)
880905
ath10k_warn(ar, "removing stale peer %pM from vdev_id %d\n",
881906
peer->addr, vdev_id);
882907

883-
for_each_set_bit(peer_id, peer->peer_ids,
884-
ATH10K_MAX_NUM_PEER_IDS) {
885-
ar->peer_map[peer_id] = NULL;
886-
}
887-
888-
/* Double check that peer is properly un-referenced from
889-
* the peer_map
890-
*/
891-
for (i = 0; i < ARRAY_SIZE(ar->peer_map); i++) {
892-
if (ar->peer_map[i] == peer) {
893-
ath10k_warn(ar, "removing stale peer_map entry for %pM (ptr %pK idx %d)\n",
894-
peer->addr, peer, i);
895-
ar->peer_map[i] = NULL;
896-
}
897-
}
898-
899-
list_del(&peer->list);
900-
kfree(peer);
901-
ar->num_peers--;
908+
ath10k_peer_map_cleanup(ar, peer);
902909
}
903910
spin_unlock_bh(&ar->data_lock);
904911
}
@@ -7621,10 +7628,7 @@ static int ath10k_sta_state(struct ieee80211_hw *hw,
76217628
/* Clean up the peer object as well since we
76227629
* must have failed to do this above.
76237630
*/
7624-
list_del(&peer->list);
7625-
ar->peer_map[i] = NULL;
7626-
kfree(peer);
7627-
ar->num_peers--;
7631+
ath10k_peer_map_cleanup(ar, peer);
76287632
}
76297633
}
76307634
spin_unlock_bh(&ar->data_lock);

drivers/net/wireless/ath/ath6kl/init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,7 @@ static int ath6kl_fetch_fw_apin(struct ath6kl *ar, const char *name)
10141014

10151015
switch (ie_id) {
10161016
case ATH6KL_FW_IE_FW_VERSION:
1017-
strlcpy(ar->wiphy->fw_version, data,
1017+
strscpy(ar->wiphy->fw_version, data,
10181018
min(sizeof(ar->wiphy->fw_version), ie_len+1));
10191019

10201020
ath6kl_dbg(ATH6KL_DBG_BOOT,

drivers/net/wireless/ath/ath9k/htc_hst.c

Lines changed: 28 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -364,33 +364,27 @@ void ath9k_htc_txcompletion_cb(struct htc_target *htc_handle,
364364
}
365365

366366
static void ath9k_htc_fw_panic_report(struct htc_target *htc_handle,
367-
struct sk_buff *skb)
367+
struct sk_buff *skb, u32 len)
368368
{
369369
uint32_t *pattern = (uint32_t *)skb->data;
370370

371-
switch (*pattern) {
372-
case 0x33221199:
373-
{
371+
if (*pattern == 0x33221199 && len >= sizeof(struct htc_panic_bad_vaddr)) {
374372
struct htc_panic_bad_vaddr *htc_panic;
375373
htc_panic = (struct htc_panic_bad_vaddr *) skb->data;
376374
dev_err(htc_handle->dev, "ath: firmware panic! "
377375
"exccause: 0x%08x; pc: 0x%08x; badvaddr: 0x%08x.\n",
378376
htc_panic->exccause, htc_panic->pc,
379377
htc_panic->badvaddr);
380-
break;
381-
}
382-
case 0x33221299:
383-
{
378+
return;
379+
}
380+
if (*pattern == 0x33221299) {
384381
struct htc_panic_bad_epid *htc_panic;
385382
htc_panic = (struct htc_panic_bad_epid *) skb->data;
386383
dev_err(htc_handle->dev, "ath: firmware panic! "
387384
"bad epid: 0x%08x\n", htc_panic->epid);
388-
break;
389-
}
390-
default:
391-
dev_err(htc_handle->dev, "ath: unknown panic pattern!\n");
392-
break;
385+
return;
393386
}
387+
dev_err(htc_handle->dev, "ath: unknown panic pattern!\n");
394388
}
395389

396390
/*
@@ -411,16 +405,26 @@ void ath9k_htc_rx_msg(struct htc_target *htc_handle,
411405
if (!htc_handle || !skb)
412406
return;
413407

408+
/* A valid message requires len >= 8.
409+
*
410+
* sizeof(struct htc_frame_hdr) == 8
411+
* sizeof(struct htc_ready_msg) == 8
412+
* sizeof(struct htc_panic_bad_vaddr) == 16
413+
* sizeof(struct htc_panic_bad_epid) == 8
414+
*/
415+
if (unlikely(len < sizeof(struct htc_frame_hdr)))
416+
goto invalid;
414417
htc_hdr = (struct htc_frame_hdr *) skb->data;
415418
epid = htc_hdr->endpoint_id;
416419

417420
if (epid == 0x99) {
418-
ath9k_htc_fw_panic_report(htc_handle, skb);
421+
ath9k_htc_fw_panic_report(htc_handle, skb, len);
419422
kfree_skb(skb);
420423
return;
421424
}
422425

423426
if (epid < 0 || epid >= ENDPOINT_MAX) {
427+
invalid:
424428
if (pipe_id != USB_REG_IN_PIPE)
425429
dev_kfree_skb_any(skb);
426430
else
@@ -432,21 +436,30 @@ void ath9k_htc_rx_msg(struct htc_target *htc_handle,
432436

433437
/* Handle trailer */
434438
if (htc_hdr->flags & HTC_FLAGS_RECV_TRAILER) {
435-
if (be32_to_cpu(*(__be32 *) skb->data) == 0x00C60000)
439+
if (be32_to_cpu(*(__be32 *) skb->data) == 0x00C60000) {
436440
/* Move past the Watchdog pattern */
437441
htc_hdr = (struct htc_frame_hdr *)(skb->data + 4);
442+
len -= 4;
443+
}
438444
}
439445

440446
/* Get the message ID */
447+
if (unlikely(len < sizeof(struct htc_frame_hdr) + sizeof(__be16)))
448+
goto invalid;
441449
msg_id = (__be16 *) ((void *) htc_hdr +
442450
sizeof(struct htc_frame_hdr));
443451

444452
/* Now process HTC messages */
445453
switch (be16_to_cpu(*msg_id)) {
446454
case HTC_MSG_READY_ID:
455+
if (unlikely(len < sizeof(struct htc_ready_msg)))
456+
goto invalid;
447457
htc_process_target_rdy(htc_handle, htc_hdr);
448458
break;
449459
case HTC_MSG_CONNECT_SERVICE_RESPONSE_ID:
460+
if (unlikely(len < sizeof(struct htc_frame_hdr) +
461+
sizeof(struct htc_conn_svc_rspmsg)))
462+
goto invalid;
450463
htc_process_conn_rsp(htc_handle, htc_hdr);
451464
break;
452465
default:

drivers/net/wireless/ath/carl9170/fw.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ static void carl9170_fw_info(struct ar9170 *ar)
105105
CARL9170FW_GET_MONTH(fw_date),
106106
CARL9170FW_GET_DAY(fw_date));
107107

108-
strlcpy(ar->hw->wiphy->fw_version, motd_desc->release,
108+
strscpy(ar->hw->wiphy->fw_version, motd_desc->release,
109109
sizeof(ar->hw->wiphy->fw_version));
110110
}
111111
}

drivers/net/wireless/ath/wil6210/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1305,7 +1305,7 @@ void wil_get_board_file(struct wil6210_priv *wil, char *buf, size_t len)
13051305
board_file = WIL_BOARD_FILE_NAME;
13061306
}
13071307

1308-
strlcpy(buf, board_file, len);
1308+
strscpy(buf, board_file, len);
13091309
}
13101310

13111311
static int wil_get_bl_info(struct wil6210_priv *wil)

drivers/net/wireless/ath/wil6210/netdev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ int wil_if_add(struct wil6210_priv *wil)
445445

446446
wil_dbg_misc(wil, "entered");
447447

448-
strlcpy(wiphy->fw_version, wil->fw_version, sizeof(wiphy->fw_version));
448+
strscpy(wiphy->fw_version, wil->fw_version, sizeof(wiphy->fw_version));
449449

450450
rc = wiphy_register(wiphy);
451451
if (rc < 0) {

drivers/net/wireless/ath/wil6210/wmi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,7 @@ static void wmi_evt_ready(struct wil6210_vif *vif, int id, void *d, int len)
780780
return; /* FW load will fail after timeout */
781781
}
782782
/* ignore MAC address, we already have it from the boot loader */
783-
strlcpy(wiphy->fw_version, wil->fw_version, sizeof(wiphy->fw_version));
783+
strscpy(wiphy->fw_version, wil->fw_version, sizeof(wiphy->fw_version));
784784

785785
if (len > offsetof(struct wmi_ready_event, rfc_read_calib_result)) {
786786
wil_dbg_wmi(wil, "rfc calibration result %d\n",

drivers/net/wireless/atmel/atmel.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1518,7 +1518,7 @@ struct net_device *init_atmel_card(unsigned short irq, unsigned long port,
15181518
priv->firmware = NULL;
15191519
priv->firmware_type = fw_type;
15201520
if (firmware) /* module parameter */
1521-
strlcpy(priv->firmware_id, firmware, sizeof(priv->firmware_id));
1521+
strscpy(priv->firmware_id, firmware, sizeof(priv->firmware_id));
15221522
priv->bus_type = card_present ? BUS_TYPE_PCCARD : BUS_TYPE_PCI;
15231523
priv->station_state = STATION_STATE_DOWN;
15241524
priv->do_rx_crc = 0;

0 commit comments

Comments
 (0)