Commit c9071401 authored by David S. Miller's avatar David S. Miller

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: default avatarDavid S. Miller <davem@davemloft.net>
parents d9c0103b 2aec9099
...@@ -2403,7 +2403,7 @@ il4965_rs_fill_link_cmd(struct il_priv *il, struct il_lq_sta *lq_sta, ...@@ -2403,7 +2403,7 @@ il4965_rs_fill_link_cmd(struct il_priv *il, struct il_lq_sta *lq_sta,
/* Repeat initial/next rate. /* Repeat initial/next rate.
* For legacy IL_NUMBER_TRY == 1, this loop will not execute. * For legacy IL_NUMBER_TRY == 1, this loop will not execute.
* For HT IL_HT_NUMBER_TRY == 3, this executes twice. */ * For HT IL_HT_NUMBER_TRY == 3, this executes twice. */
while (repeat_rate > 0) { while (repeat_rate > 0 && idx < (LINK_QUAL_MAX_RETRY_NUM - 1)) {
if (is_legacy(tbl_type.lq_type)) { if (is_legacy(tbl_type.lq_type)) {
if (ant_toggle_cnt < NUM_TRY_BEFORE_ANT_TOGGLE) if (ant_toggle_cnt < NUM_TRY_BEFORE_ANT_TOGGLE)
ant_toggle_cnt++; ant_toggle_cnt++;
...@@ -2422,8 +2422,6 @@ il4965_rs_fill_link_cmd(struct il_priv *il, struct il_lq_sta *lq_sta, ...@@ -2422,8 +2422,6 @@ il4965_rs_fill_link_cmd(struct il_priv *il, struct il_lq_sta *lq_sta,
cpu_to_le32(new_rate); cpu_to_le32(new_rate);
repeat_rate--; repeat_rate--;
idx++; idx++;
if (idx >= LINK_QUAL_MAX_RETRY_NUM)
goto out;
} }
il4965_rs_get_tbl_info_from_mcs(new_rate, lq_sta->band, 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, ...@@ -2468,7 +2466,6 @@ il4965_rs_fill_link_cmd(struct il_priv *il, struct il_lq_sta *lq_sta,
repeat_rate--; repeat_rate--;
} }
out:
lq_cmd->agg_params.agg_frame_cnt_limit = LINK_QUAL_AGG_FRAME_LIMIT_DEF; lq_cmd->agg_params.agg_frame_cnt_limit = LINK_QUAL_AGG_FRAME_LIMIT_DEF;
lq_cmd->agg_params.agg_dis_start_th = LINK_QUAL_AGG_DISABLE_START_DEF; lq_cmd->agg_params.agg_dis_start_th = LINK_QUAL_AGG_DISABLE_START_DEF;
......
...@@ -5060,6 +5060,10 @@ static int hwsim_virtio_handle_cmd(struct sk_buff *skb) ...@@ -5060,6 +5060,10 @@ static int hwsim_virtio_handle_cmd(struct sk_buff *skb)
nlh = nlmsg_hdr(skb); nlh = nlmsg_hdr(skb);
gnlh = nlmsg_data(nlh); gnlh = nlmsg_data(nlh);
if (skb->len < nlh->nlmsg_len)
return -EINVAL;
err = genlmsg_parse(nlh, &hwsim_genl_family, tb, HWSIM_ATTR_MAX, err = genlmsg_parse(nlh, &hwsim_genl_family, tb, HWSIM_ATTR_MAX,
hwsim_genl_policy, NULL); hwsim_genl_policy, NULL);
if (err) { if (err) {
...@@ -5102,7 +5106,8 @@ static void hwsim_virtio_rx_work(struct work_struct *work) ...@@ -5102,7 +5106,8 @@ static void hwsim_virtio_rx_work(struct work_struct *work)
spin_unlock_irqrestore(&hwsim_virtio_lock, flags); spin_unlock_irqrestore(&hwsim_virtio_lock, flags);
skb->data = skb->head; skb->data = skb->head;
skb_set_tail_pointer(skb, len); skb_reset_tail_pointer(skb);
skb_put(skb, len);
hwsim_virtio_handle_cmd(skb); hwsim_virtio_handle_cmd(skb);
spin_lock_irqsave(&hwsim_virtio_lock, flags); spin_lock_irqsave(&hwsim_virtio_lock, flags);
......
...@@ -261,7 +261,7 @@ int mt7921e_mac_reset(struct mt7921_dev *dev) ...@@ -261,7 +261,7 @@ int mt7921e_mac_reset(struct mt7921_dev *dev)
err = mt7921e_driver_own(dev); err = mt7921e_driver_own(dev);
if (err) if (err)
return err; goto out;
err = mt7921_run_firmware(dev); err = mt7921_run_firmware(dev);
if (err) if (err)
......
...@@ -245,6 +245,7 @@ struct wilc { ...@@ -245,6 +245,7 @@ struct wilc {
u8 *rx_buffer; u8 *rx_buffer;
u32 rx_buffer_offset; u32 rx_buffer_offset;
u8 *tx_buffer; u8 *tx_buffer;
u32 *vmm_table;
struct txq_handle txq[NQUEUES]; struct txq_handle txq[NQUEUES];
int txq_entries; int txq_entries;
......
...@@ -28,6 +28,7 @@ struct wilc_sdio { ...@@ -28,6 +28,7 @@ struct wilc_sdio {
u32 block_size; u32 block_size;
bool isinit; bool isinit;
int has_thrpt_enh3; int has_thrpt_enh3;
u8 *cmd53_buf;
}; };
struct sdio_cmd52 { struct sdio_cmd52 {
...@@ -47,6 +48,7 @@ struct sdio_cmd53 { ...@@ -47,6 +48,7 @@ struct sdio_cmd53 {
u32 count: 9; u32 count: 9;
u8 *buffer; u8 *buffer;
u32 block_size; u32 block_size;
bool use_global_buf;
}; };
static const struct wilc_hif_func wilc_hif_sdio; 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) ...@@ -91,6 +93,8 @@ static int wilc_sdio_cmd53(struct wilc *wilc, struct sdio_cmd53 *cmd)
{ {
struct sdio_func *func = container_of(wilc->dev, struct sdio_func, dev); struct sdio_func *func = container_of(wilc->dev, struct sdio_func, dev);
int size, ret; int size, ret;
struct wilc_sdio *sdio_priv = wilc->bus_data;
u8 *buf = cmd->buffer;
sdio_claim_host(func); sdio_claim_host(func);
...@@ -101,12 +105,23 @@ static int wilc_sdio_cmd53(struct wilc *wilc, struct sdio_cmd53 *cmd) ...@@ -101,12 +105,23 @@ static int wilc_sdio_cmd53(struct wilc *wilc, struct sdio_cmd53 *cmd)
else else
size = cmd->count; size = cmd->count;
if (cmd->use_global_buf) {
if (size > sizeof(u32))
return -EINVAL;
buf = sdio_priv->cmd53_buf;
}
if (cmd->read_write) { /* write */ if (cmd->read_write) { /* write */
ret = sdio_memcpy_toio(func, cmd->address, if (cmd->use_global_buf)
(void *)cmd->buffer, size); memcpy(buf, cmd->buffer, size);
ret = sdio_memcpy_toio(func, cmd->address, buf, size);
} else { /* read */ } else { /* read */
ret = sdio_memcpy_fromio(func, (void *)cmd->buffer, ret = sdio_memcpy_fromio(func, buf, cmd->address, size);
cmd->address, size);
if (cmd->use_global_buf)
memcpy(cmd->buffer, buf, size);
} }
sdio_release_host(func); sdio_release_host(func);
...@@ -128,6 +143,12 @@ static int wilc_sdio_probe(struct sdio_func *func, ...@@ -128,6 +143,12 @@ static int wilc_sdio_probe(struct sdio_func *func,
if (!sdio_priv) if (!sdio_priv)
return -ENOMEM; return -ENOMEM;
sdio_priv->cmd53_buf = kzalloc(sizeof(u32), GFP_KERNEL);
if (!sdio_priv->cmd53_buf) {
ret = -ENOMEM;
goto free;
}
ret = wilc_cfg80211_init(&wilc, &func->dev, WILC_HIF_SDIO, ret = wilc_cfg80211_init(&wilc, &func->dev, WILC_HIF_SDIO,
&wilc_hif_sdio); &wilc_hif_sdio);
if (ret) if (ret)
...@@ -161,6 +182,7 @@ static int wilc_sdio_probe(struct sdio_func *func, ...@@ -161,6 +182,7 @@ static int wilc_sdio_probe(struct sdio_func *func,
irq_dispose_mapping(wilc->dev_irq_num); irq_dispose_mapping(wilc->dev_irq_num);
wilc_netdev_cleanup(wilc); wilc_netdev_cleanup(wilc);
free: free:
kfree(sdio_priv->cmd53_buf);
kfree(sdio_priv); kfree(sdio_priv);
return ret; return ret;
} }
...@@ -172,6 +194,7 @@ static void wilc_sdio_remove(struct sdio_func *func) ...@@ -172,6 +194,7 @@ static void wilc_sdio_remove(struct sdio_func *func)
clk_disable_unprepare(wilc->rtc_clk); clk_disable_unprepare(wilc->rtc_clk);
wilc_netdev_cleanup(wilc); wilc_netdev_cleanup(wilc);
kfree(sdio_priv->cmd53_buf);
kfree(sdio_priv); kfree(sdio_priv);
} }
...@@ -375,8 +398,9 @@ static int wilc_sdio_write_reg(struct wilc *wilc, u32 addr, u32 data) ...@@ -375,8 +398,9 @@ static int wilc_sdio_write_reg(struct wilc *wilc, u32 addr, u32 data)
cmd.address = WILC_SDIO_FBR_DATA_REG; cmd.address = WILC_SDIO_FBR_DATA_REG;
cmd.block_mode = 0; cmd.block_mode = 0;
cmd.increment = 1; cmd.increment = 1;
cmd.count = 4; cmd.count = sizeof(u32);
cmd.buffer = (u8 *)&data; cmd.buffer = (u8 *)&data;
cmd.use_global_buf = true;
cmd.block_size = sdio_priv->block_size; cmd.block_size = sdio_priv->block_size;
ret = wilc_sdio_cmd53(wilc, &cmd); ret = wilc_sdio_cmd53(wilc, &cmd);
if (ret) if (ret)
...@@ -414,6 +438,7 @@ static int wilc_sdio_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size) ...@@ -414,6 +438,7 @@ static int wilc_sdio_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size)
nblk = size / block_size; nblk = size / block_size;
nleft = size % block_size; nleft = size % block_size;
cmd.use_global_buf = false;
if (nblk > 0) { if (nblk > 0) {
cmd.block_mode = 1; cmd.block_mode = 1;
cmd.increment = 1; cmd.increment = 1;
...@@ -492,8 +517,9 @@ static int wilc_sdio_read_reg(struct wilc *wilc, u32 addr, u32 *data) ...@@ -492,8 +517,9 @@ static int wilc_sdio_read_reg(struct wilc *wilc, u32 addr, u32 *data)
cmd.address = WILC_SDIO_FBR_DATA_REG; cmd.address = WILC_SDIO_FBR_DATA_REG;
cmd.block_mode = 0; cmd.block_mode = 0;
cmd.increment = 1; cmd.increment = 1;
cmd.count = 4; cmd.count = sizeof(u32);
cmd.buffer = (u8 *)data; cmd.buffer = (u8 *)data;
cmd.use_global_buf = true;
cmd.block_size = sdio_priv->block_size; cmd.block_size = sdio_priv->block_size;
ret = wilc_sdio_cmd53(wilc, &cmd); ret = wilc_sdio_cmd53(wilc, &cmd);
...@@ -535,6 +561,7 @@ static int wilc_sdio_read(struct wilc *wilc, u32 addr, u8 *buf, u32 size) ...@@ -535,6 +561,7 @@ static int wilc_sdio_read(struct wilc *wilc, u32 addr, u8 *buf, u32 size)
nblk = size / block_size; nblk = size / block_size;
nleft = size % block_size; nleft = size % block_size;
cmd.use_global_buf = false;
if (nblk > 0) { if (nblk > 0) {
cmd.block_mode = 1; cmd.block_mode = 1;
cmd.increment = 1; cmd.increment = 1;
......
...@@ -714,7 +714,7 @@ int wilc_wlan_handle_txq(struct wilc *wilc, u32 *txq_count) ...@@ -714,7 +714,7 @@ int wilc_wlan_handle_txq(struct wilc *wilc, u32 *txq_count)
int ret = 0; int ret = 0;
int counter; int counter;
int timeout; int timeout;
u32 vmm_table[WILC_VMM_TBL_SIZE]; u32 *vmm_table = wilc->vmm_table;
u8 ac_pkt_num_to_chip[NQUEUES] = {0, 0, 0, 0}; u8 ac_pkt_num_to_chip[NQUEUES] = {0, 0, 0, 0};
const struct wilc_hif_func *func; const struct wilc_hif_func *func;
int srcu_idx; int srcu_idx;
...@@ -1252,6 +1252,8 @@ void wilc_wlan_cleanup(struct net_device *dev) ...@@ -1252,6 +1252,8 @@ void wilc_wlan_cleanup(struct net_device *dev)
while ((rqe = wilc_wlan_rxq_remove(wilc))) while ((rqe = wilc_wlan_rxq_remove(wilc)))
kfree(rqe); kfree(rqe);
kfree(wilc->vmm_table);
wilc->vmm_table = NULL;
kfree(wilc->rx_buffer); kfree(wilc->rx_buffer);
wilc->rx_buffer = NULL; wilc->rx_buffer = NULL;
kfree(wilc->tx_buffer); kfree(wilc->tx_buffer);
...@@ -1489,6 +1491,14 @@ int wilc_wlan_init(struct net_device *dev) ...@@ -1489,6 +1491,14 @@ int wilc_wlan_init(struct net_device *dev)
goto fail; goto fail;
} }
if (!wilc->vmm_table)
wilc->vmm_table = kzalloc(WILC_VMM_TBL_SIZE, GFP_KERNEL);
if (!wilc->vmm_table) {
ret = -ENOBUFS;
goto fail;
}
if (!wilc->tx_buffer) if (!wilc->tx_buffer)
wilc->tx_buffer = kmalloc(WILC_TX_BUFF_SIZE, GFP_KERNEL); wilc->tx_buffer = kmalloc(WILC_TX_BUFF_SIZE, GFP_KERNEL);
...@@ -1513,7 +1523,8 @@ int wilc_wlan_init(struct net_device *dev) ...@@ -1513,7 +1523,8 @@ int wilc_wlan_init(struct net_device *dev)
return 0; return 0;
fail: fail:
kfree(wilc->vmm_table);
wilc->vmm_table = NULL;
kfree(wilc->rx_buffer); kfree(wilc->rx_buffer);
wilc->rx_buffer = NULL; wilc->rx_buffer = NULL;
kfree(wilc->tx_buffer); kfree(wilc->tx_buffer);
......
...@@ -310,9 +310,11 @@ static inline u16 ieee80211_sn_sub(u16 sn1, u16 sn2) ...@@ -310,9 +310,11 @@ static inline u16 ieee80211_sn_sub(u16 sn1, u16 sn2)
struct ieee80211_hdr { struct ieee80211_hdr {
__le16 frame_control; __le16 frame_control;
__le16 duration_id; __le16 duration_id;
u8 addr1[ETH_ALEN]; struct_group(addrs,
u8 addr2[ETH_ALEN]; u8 addr1[ETH_ALEN];
u8 addr3[ETH_ALEN]; u8 addr2[ETH_ALEN];
u8 addr3[ETH_ALEN];
);
__le16 seq_ctrl; __le16 seq_ctrl;
u8 addr4[ETH_ALEN]; u8 addr4[ETH_ALEN];
} __packed __aligned(2); } __packed __aligned(2);
......
...@@ -3420,11 +3420,11 @@ static void ieee80211_destroy_auth_data(struct ieee80211_sub_if_data *sdata, ...@@ -3420,11 +3420,11 @@ static void ieee80211_destroy_auth_data(struct ieee80211_sub_if_data *sdata,
ieee80211_link_info_change_notify(sdata, &sdata->deflink, ieee80211_link_info_change_notify(sdata, &sdata->deflink,
BSS_CHANGED_BSSID); BSS_CHANGED_BSSID);
sdata->u.mgd.flags = 0; sdata->u.mgd.flags = 0;
mutex_lock(&sdata->local->mtx); mutex_lock(&sdata->local->mtx);
ieee80211_link_release_channel(&sdata->deflink); ieee80211_link_release_channel(&sdata->deflink);
mutex_unlock(&sdata->local->mtx);
ieee80211_vif_set_links(sdata, 0); ieee80211_vif_set_links(sdata, 0);
mutex_unlock(&sdata->local->mtx);
} }
cfg80211_put_bss(sdata->local->hw.wiphy, auth_data->bss); 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, ...@@ -3462,10 +3462,6 @@ static void ieee80211_destroy_assoc_data(struct ieee80211_sub_if_data *sdata,
sdata->u.mgd.flags = 0; sdata->u.mgd.flags = 0;
sdata->vif.bss_conf.mu_mimo_owner = false; sdata->vif.bss_conf.mu_mimo_owner = false;
mutex_lock(&sdata->local->mtx);
ieee80211_link_release_channel(&sdata->deflink);
mutex_unlock(&sdata->local->mtx);
if (status != ASSOC_REJECTED) { if (status != ASSOC_REJECTED) {
struct cfg80211_assoc_failure data = { struct cfg80211_assoc_failure data = {
.timeout = status == ASSOC_TIMEOUT, .timeout = status == ASSOC_TIMEOUT,
...@@ -3484,7 +3480,10 @@ static void ieee80211_destroy_assoc_data(struct ieee80211_sub_if_data *sdata, ...@@ -3484,7 +3480,10 @@ static void ieee80211_destroy_assoc_data(struct ieee80211_sub_if_data *sdata,
cfg80211_assoc_failure(sdata->dev, &data); cfg80211_assoc_failure(sdata->dev, &data);
} }
mutex_lock(&sdata->local->mtx);
ieee80211_link_release_channel(&sdata->deflink);
ieee80211_vif_set_links(sdata, 0); ieee80211_vif_set_links(sdata, 0);
mutex_unlock(&sdata->local->mtx);
} }
kfree(assoc_data); kfree(assoc_data);
...@@ -6509,6 +6508,7 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata, ...@@ -6509,6 +6508,7 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata,
return 0; return 0;
out_err: out_err:
ieee80211_link_release_channel(&sdata->deflink);
ieee80211_vif_set_links(sdata, 0); ieee80211_vif_set_links(sdata, 0);
return err; return err;
} }
......
...@@ -4074,6 +4074,7 @@ void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid) ...@@ -4074,6 +4074,7 @@ void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid)
.link_id = -1, .link_id = -1,
}; };
struct tid_ampdu_rx *tid_agg_rx; struct tid_ampdu_rx *tid_agg_rx;
u8 link_id;
tid_agg_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[tid]); tid_agg_rx = rcu_dereference(sta->ampdu_mlme.tid_rx[tid]);
if (!tid_agg_rx) if (!tid_agg_rx)
...@@ -4093,6 +4094,9 @@ void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid) ...@@ -4093,6 +4094,9 @@ void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid)
}; };
drv_event_callback(rx.local, rx.sdata, &event); drv_event_callback(rx.local, rx.sdata, &event);
} }
/* FIXME: statistics won't be right with this */
link_id = sta->sta.valid_links ? ffs(sta->sta.valid_links) - 1 : 0;
rx.link = rcu_dereference(sta->sdata->link[link_id]);
ieee80211_rx_handlers(&rx, &frames); ieee80211_rx_handlers(&rx, &frames);
} }
......
...@@ -351,7 +351,7 @@ static u8 ccmp_gcmp_aad(struct sk_buff *skb, u8 *aad) ...@@ -351,7 +351,7 @@ static u8 ccmp_gcmp_aad(struct sk_buff *skb, u8 *aad)
* FC | A1 | A2 | A3 | SC | [A4] | [QC] */ * FC | A1 | A2 | A3 | SC | [A4] | [QC] */
put_unaligned_be16(len_a, &aad[0]); put_unaligned_be16(len_a, &aad[0]);
put_unaligned(mask_fc, (__le16 *)&aad[2]); put_unaligned(mask_fc, (__le16 *)&aad[2]);
memcpy(&aad[4], &hdr->addr1, 3 * ETH_ALEN); memcpy(&aad[4], &hdr->addrs, 3 * ETH_ALEN);
/* Mask Seq#, leave Frag# */ /* Mask Seq#, leave Frag# */
aad[22] = *((u8 *) &hdr->seq_ctrl) & 0x0f; aad[22] = *((u8 *) &hdr->seq_ctrl) & 0x0f;
...@@ -792,7 +792,7 @@ static void bip_aad(struct sk_buff *skb, u8 *aad) ...@@ -792,7 +792,7 @@ static void bip_aad(struct sk_buff *skb, u8 *aad)
IEEE80211_FCTL_MOREDATA); IEEE80211_FCTL_MOREDATA);
put_unaligned(mask_fc, (__le16 *) &aad[0]); put_unaligned(mask_fc, (__le16 *) &aad[0]);
/* A1 || A2 || A3 */ /* A1 || A2 || A3 */
memcpy(aad + 2, &hdr->addr1, 3 * ETH_ALEN); memcpy(aad + 2, &hdr->addrs, 3 * ETH_ALEN);
} }
......
...@@ -136,7 +136,7 @@ static int ccmp_init_iv_and_aad(const struct ieee80211_hdr *hdr, ...@@ -136,7 +136,7 @@ static int ccmp_init_iv_and_aad(const struct ieee80211_hdr *hdr,
pos = (u8 *) hdr; pos = (u8 *) hdr;
aad[0] = pos[0] & 0x8f; aad[0] = pos[0] & 0x8f;
aad[1] = pos[1] & 0xc7; aad[1] = pos[1] & 0xc7;
memcpy(aad + 2, hdr->addr1, 3 * ETH_ALEN); memcpy(aad + 2, &hdr->addrs, 3 * ETH_ALEN);
pos = (u8 *) & hdr->seq_ctrl; pos = (u8 *) & hdr->seq_ctrl;
aad[20] = pos[0] & 0x0f; aad[20] = pos[0] & 0x0f;
aad[21] = 0; /* all bits masked */ aad[21] = 0; /* all bits masked */
......
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