Skip to content

Commit c907140

Browse files
committed
Merge tag 'wireless-2022-09-03' of git://git.kernel.org/pub/scm/linux/kernel/git/wireless/wireless
Johannes berg says: ==================== We have a handful of fixes: - fix DMA from stack in wilc1000 driver - fix crash on chip reset failure in mt7921e - fix for the reported warning on aggregation timer expiry - check packet lengths in hwsim virtio paths - fix compiler warnings/errors with AAD construction by using struct_group - fix Intel 4965 driver rate scale operation - release channel contexts correctly in mac80211 mlme code ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2 parents d9c0103 + 2aec909 commit c907140

11 files changed

Lines changed: 73 additions & 26 deletions

File tree

drivers/net/wireless/intel/iwlegacy/4965-rs.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2403,7 +2403,7 @@ il4965_rs_fill_link_cmd(struct il_priv *il, struct il_lq_sta *lq_sta,
24032403
/* Repeat initial/next rate.
24042404
* For legacy IL_NUMBER_TRY == 1, this loop will not execute.
24052405
* For HT IL_HT_NUMBER_TRY == 3, this executes twice. */
2406-
while (repeat_rate > 0) {
2406+
while (repeat_rate > 0 && idx < (LINK_QUAL_MAX_RETRY_NUM - 1)) {
24072407
if (is_legacy(tbl_type.lq_type)) {
24082408
if (ant_toggle_cnt < NUM_TRY_BEFORE_ANT_TOGGLE)
24092409
ant_toggle_cnt++;
@@ -2422,8 +2422,6 @@ il4965_rs_fill_link_cmd(struct il_priv *il, struct il_lq_sta *lq_sta,
24222422
cpu_to_le32(new_rate);
24232423
repeat_rate--;
24242424
idx++;
2425-
if (idx >= LINK_QUAL_MAX_RETRY_NUM)
2426-
goto out;
24272425
}
24282426

24292427
il4965_rs_get_tbl_info_from_mcs(new_rate, lq_sta->band,
@@ -2468,7 +2466,6 @@ il4965_rs_fill_link_cmd(struct il_priv *il, struct il_lq_sta *lq_sta,
24682466
repeat_rate--;
24692467
}
24702468

2471-
out:
24722469
lq_cmd->agg_params.agg_frame_cnt_limit = LINK_QUAL_AGG_FRAME_LIMIT_DEF;
24732470
lq_cmd->agg_params.agg_dis_start_th = LINK_QUAL_AGG_DISABLE_START_DEF;
24742471

drivers/net/wireless/mac80211_hwsim.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5060,6 +5060,10 @@ static int hwsim_virtio_handle_cmd(struct sk_buff *skb)
50605060

50615061
nlh = nlmsg_hdr(skb);
50625062
gnlh = nlmsg_data(nlh);
5063+
5064+
if (skb->len < nlh->nlmsg_len)
5065+
return -EINVAL;
5066+
50635067
err = genlmsg_parse(nlh, &hwsim_genl_family, tb, HWSIM_ATTR_MAX,
50645068
hwsim_genl_policy, NULL);
50655069
if (err) {
@@ -5102,7 +5106,8 @@ static void hwsim_virtio_rx_work(struct work_struct *work)
51025106
spin_unlock_irqrestore(&hwsim_virtio_lock, flags);
51035107

51045108
skb->data = skb->head;
5105-
skb_set_tail_pointer(skb, len);
5109+
skb_reset_tail_pointer(skb);
5110+
skb_put(skb, len);
51065111
hwsim_virtio_handle_cmd(skb);
51075112

51085113
spin_lock_irqsave(&hwsim_virtio_lock, flags);

drivers/net/wireless/mediatek/mt76/mt7921/pci_mac.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ int mt7921e_mac_reset(struct mt7921_dev *dev)
261261

262262
err = mt7921e_driver_own(dev);
263263
if (err)
264-
return err;
264+
goto out;
265265

266266
err = mt7921_run_firmware(dev);
267267
if (err)

drivers/net/wireless/microchip/wilc1000/netdev.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ struct wilc {
245245
u8 *rx_buffer;
246246
u32 rx_buffer_offset;
247247
u8 *tx_buffer;
248+
u32 *vmm_table;
248249

249250
struct txq_handle txq[NQUEUES];
250251
int txq_entries;

drivers/net/wireless/microchip/wilc1000/sdio.c

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ struct wilc_sdio {
2828
u32 block_size;
2929
bool isinit;
3030
int has_thrpt_enh3;
31+
u8 *cmd53_buf;
3132
};
3233

3334
struct sdio_cmd52 {
@@ -47,6 +48,7 @@ struct sdio_cmd53 {
4748
u32 count: 9;
4849
u8 *buffer;
4950
u32 block_size;
51+
bool use_global_buf;
5052
};
5153

5254
static const struct wilc_hif_func wilc_hif_sdio;
@@ -91,6 +93,8 @@ static int wilc_sdio_cmd53(struct wilc *wilc, struct sdio_cmd53 *cmd)
9193
{
9294
struct sdio_func *func = container_of(wilc->dev, struct sdio_func, dev);
9395
int size, ret;
96+
struct wilc_sdio *sdio_priv = wilc->bus_data;
97+
u8 *buf = cmd->buffer;
9498

9599
sdio_claim_host(func);
96100

@@ -101,12 +105,23 @@ static int wilc_sdio_cmd53(struct wilc *wilc, struct sdio_cmd53 *cmd)
101105
else
102106
size = cmd->count;
103107

108+
if (cmd->use_global_buf) {
109+
if (size > sizeof(u32))
110+
return -EINVAL;
111+
112+
buf = sdio_priv->cmd53_buf;
113+
}
114+
104115
if (cmd->read_write) { /* write */
105-
ret = sdio_memcpy_toio(func, cmd->address,
106-
(void *)cmd->buffer, size);
116+
if (cmd->use_global_buf)
117+
memcpy(buf, cmd->buffer, size);
118+
119+
ret = sdio_memcpy_toio(func, cmd->address, buf, size);
107120
} else { /* read */
108-
ret = sdio_memcpy_fromio(func, (void *)cmd->buffer,
109-
cmd->address, size);
121+
ret = sdio_memcpy_fromio(func, buf, cmd->address, size);
122+
123+
if (cmd->use_global_buf)
124+
memcpy(cmd->buffer, buf, size);
110125
}
111126

112127
sdio_release_host(func);
@@ -128,6 +143,12 @@ static int wilc_sdio_probe(struct sdio_func *func,
128143
if (!sdio_priv)
129144
return -ENOMEM;
130145

146+
sdio_priv->cmd53_buf = kzalloc(sizeof(u32), GFP_KERNEL);
147+
if (!sdio_priv->cmd53_buf) {
148+
ret = -ENOMEM;
149+
goto free;
150+
}
151+
131152
ret = wilc_cfg80211_init(&wilc, &func->dev, WILC_HIF_SDIO,
132153
&wilc_hif_sdio);
133154
if (ret)
@@ -161,6 +182,7 @@ static int wilc_sdio_probe(struct sdio_func *func,
161182
irq_dispose_mapping(wilc->dev_irq_num);
162183
wilc_netdev_cleanup(wilc);
163184
free:
185+
kfree(sdio_priv->cmd53_buf);
164186
kfree(sdio_priv);
165187
return ret;
166188
}
@@ -172,6 +194,7 @@ static void wilc_sdio_remove(struct sdio_func *func)
172194

173195
clk_disable_unprepare(wilc->rtc_clk);
174196
wilc_netdev_cleanup(wilc);
197+
kfree(sdio_priv->cmd53_buf);
175198
kfree(sdio_priv);
176199
}
177200

@@ -375,8 +398,9 @@ static int wilc_sdio_write_reg(struct wilc *wilc, u32 addr, u32 data)
375398
cmd.address = WILC_SDIO_FBR_DATA_REG;
376399
cmd.block_mode = 0;
377400
cmd.increment = 1;
378-
cmd.count = 4;
401+
cmd.count = sizeof(u32);
379402
cmd.buffer = (u8 *)&data;
403+
cmd.use_global_buf = true;
380404
cmd.block_size = sdio_priv->block_size;
381405
ret = wilc_sdio_cmd53(wilc, &cmd);
382406
if (ret)
@@ -414,6 +438,7 @@ static int wilc_sdio_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size)
414438
nblk = size / block_size;
415439
nleft = size % block_size;
416440

441+
cmd.use_global_buf = false;
417442
if (nblk > 0) {
418443
cmd.block_mode = 1;
419444
cmd.increment = 1;
@@ -492,8 +517,9 @@ static int wilc_sdio_read_reg(struct wilc *wilc, u32 addr, u32 *data)
492517
cmd.address = WILC_SDIO_FBR_DATA_REG;
493518
cmd.block_mode = 0;
494519
cmd.increment = 1;
495-
cmd.count = 4;
520+
cmd.count = sizeof(u32);
496521
cmd.buffer = (u8 *)data;
522+
cmd.use_global_buf = true;
497523

498524
cmd.block_size = sdio_priv->block_size;
499525
ret = wilc_sdio_cmd53(wilc, &cmd);
@@ -535,6 +561,7 @@ static int wilc_sdio_read(struct wilc *wilc, u32 addr, u8 *buf, u32 size)
535561
nblk = size / block_size;
536562
nleft = size % block_size;
537563

564+
cmd.use_global_buf = false;
538565
if (nblk > 0) {
539566
cmd.block_mode = 1;
540567
cmd.increment = 1;

drivers/net/wireless/microchip/wilc1000/wlan.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ int wilc_wlan_handle_txq(struct wilc *wilc, u32 *txq_count)
714714
int ret = 0;
715715
int counter;
716716
int timeout;
717-
u32 vmm_table[WILC_VMM_TBL_SIZE];
717+
u32 *vmm_table = wilc->vmm_table;
718718
u8 ac_pkt_num_to_chip[NQUEUES] = {0, 0, 0, 0};
719719
const struct wilc_hif_func *func;
720720
int srcu_idx;
@@ -1252,6 +1252,8 @@ void wilc_wlan_cleanup(struct net_device *dev)
12521252
while ((rqe = wilc_wlan_rxq_remove(wilc)))
12531253
kfree(rqe);
12541254

1255+
kfree(wilc->vmm_table);
1256+
wilc->vmm_table = NULL;
12551257
kfree(wilc->rx_buffer);
12561258
wilc->rx_buffer = NULL;
12571259
kfree(wilc->tx_buffer);
@@ -1489,6 +1491,14 @@ int wilc_wlan_init(struct net_device *dev)
14891491
goto fail;
14901492
}
14911493

1494+
if (!wilc->vmm_table)
1495+
wilc->vmm_table = kzalloc(WILC_VMM_TBL_SIZE, GFP_KERNEL);
1496+
1497+
if (!wilc->vmm_table) {
1498+
ret = -ENOBUFS;
1499+
goto fail;
1500+
}
1501+
14921502
if (!wilc->tx_buffer)
14931503
wilc->tx_buffer = kmalloc(WILC_TX_BUFF_SIZE, GFP_KERNEL);
14941504

@@ -1513,7 +1523,8 @@ int wilc_wlan_init(struct net_device *dev)
15131523
return 0;
15141524

15151525
fail:
1516-
1526+
kfree(wilc->vmm_table);
1527+
wilc->vmm_table = NULL;
15171528
kfree(wilc->rx_buffer);
15181529
wilc->rx_buffer = NULL;
15191530
kfree(wilc->tx_buffer);

include/linux/ieee80211.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,9 +310,11 @@ static inline u16 ieee80211_sn_sub(u16 sn1, u16 sn2)
310310
struct ieee80211_hdr {
311311
__le16 frame_control;
312312
__le16 duration_id;
313-
u8 addr1[ETH_ALEN];
314-
u8 addr2[ETH_ALEN];
315-
u8 addr3[ETH_ALEN];
313+
struct_group(addrs,
314+
u8 addr1[ETH_ALEN];
315+
u8 addr2[ETH_ALEN];
316+
u8 addr3[ETH_ALEN];
317+
);
316318
__le16 seq_ctrl;
317319
u8 addr4[ETH_ALEN];
318320
} __packed __aligned(2);

net/mac80211/mlme.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3420,11 +3420,11 @@ static void ieee80211_destroy_auth_data(struct ieee80211_sub_if_data *sdata,
34203420
ieee80211_link_info_change_notify(sdata, &sdata->deflink,
34213421
BSS_CHANGED_BSSID);
34223422
sdata->u.mgd.flags = 0;
3423+
34233424
mutex_lock(&sdata->local->mtx);
34243425
ieee80211_link_release_channel(&sdata->deflink);
3425-
mutex_unlock(&sdata->local->mtx);
3426-
34273426
ieee80211_vif_set_links(sdata, 0);
3427+
mutex_unlock(&sdata->local->mtx);
34283428
}
34293429

34303430
cfg80211_put_bss(sdata->local->hw.wiphy, auth_data->bss);
@@ -3462,10 +3462,6 @@ static void ieee80211_destroy_assoc_data(struct ieee80211_sub_if_data *sdata,
34623462
sdata->u.mgd.flags = 0;
34633463
sdata->vif.bss_conf.mu_mimo_owner = false;
34643464

3465-
mutex_lock(&sdata->local->mtx);
3466-
ieee80211_link_release_channel(&sdata->deflink);
3467-
mutex_unlock(&sdata->local->mtx);
3468-
34693465
if (status != ASSOC_REJECTED) {
34703466
struct cfg80211_assoc_failure data = {
34713467
.timeout = status == ASSOC_TIMEOUT,
@@ -3484,7 +3480,10 @@ static void ieee80211_destroy_assoc_data(struct ieee80211_sub_if_data *sdata,
34843480
cfg80211_assoc_failure(sdata->dev, &data);
34853481
}
34863482

3483+
mutex_lock(&sdata->local->mtx);
3484+
ieee80211_link_release_channel(&sdata->deflink);
34873485
ieee80211_vif_set_links(sdata, 0);
3486+
mutex_unlock(&sdata->local->mtx);
34883487
}
34893488

34903489
kfree(assoc_data);
@@ -6509,6 +6508,7 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata,
65096508
return 0;
65106509

65116510
out_err:
6511+
ieee80211_link_release_channel(&sdata->deflink);
65126512
ieee80211_vif_set_links(sdata, 0);
65136513
return err;
65146514
}

net/mac80211/rx.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4074,6 +4074,7 @@ void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid)
40744074
.link_id = -1,
40754075
};
40764076
struct tid_ampdu_rx *tid_agg_rx;
4077+
u8 link_id;
40774078

40784079
tid_agg_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[tid]);
40794080
if (!tid_agg_rx)
@@ -4093,6 +4094,9 @@ void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid)
40934094
};
40944095
drv_event_callback(rx.local, rx.sdata, &event);
40954096
}
4097+
/* FIXME: statistics won't be right with this */
4098+
link_id = sta->sta.valid_links ? ffs(sta->sta.valid_links) - 1 : 0;
4099+
rx.link = rcu_dereference(sta->sdata->link[link_id]);
40964100

40974101
ieee80211_rx_handlers(&rx, &frames);
40984102
}

net/mac80211/wpa.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ static u8 ccmp_gcmp_aad(struct sk_buff *skb, u8 *aad)
351351
* FC | A1 | A2 | A3 | SC | [A4] | [QC] */
352352
put_unaligned_be16(len_a, &aad[0]);
353353
put_unaligned(mask_fc, (__le16 *)&aad[2]);
354-
memcpy(&aad[4], &hdr->addr1, 3 * ETH_ALEN);
354+
memcpy(&aad[4], &hdr->addrs, 3 * ETH_ALEN);
355355

356356
/* Mask Seq#, leave Frag# */
357357
aad[22] = *((u8 *) &hdr->seq_ctrl) & 0x0f;
@@ -792,7 +792,7 @@ static void bip_aad(struct sk_buff *skb, u8 *aad)
792792
IEEE80211_FCTL_MOREDATA);
793793
put_unaligned(mask_fc, (__le16 *) &aad[0]);
794794
/* A1 || A2 || A3 */
795-
memcpy(aad + 2, &hdr->addr1, 3 * ETH_ALEN);
795+
memcpy(aad + 2, &hdr->addrs, 3 * ETH_ALEN);
796796
}
797797

798798

0 commit comments

Comments
 (0)