Skip to content

Commit c11fb98

Browse files
Avinash Patillinvjw
authored andcommitted
mwifiex: guard station nodes access by station list lock
Station node entries should be guarded for whole of their reference instead of just while getting node entry from station list. It may happen that station node is retrieved may be deleted by deauthentication event while it is still in use. Reported by: Tim Shepard <shep@xplot.org> Signed-off-by: Avinash Patil <patila@marvell.com> Signed-off-by: Cathy Luo <cluo@marvell.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent 9817fff commit c11fb98

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

drivers/net/wireless/mwifiex/11n.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,7 @@ int mwifiex_send_addba(struct mwifiex_private *priv, int tid, u8 *peer_mac)
544544
u32 tx_win_size = priv->add_ba_param.tx_win_size;
545545
static u8 dialog_tok;
546546
int ret;
547+
unsigned long flags;
547548
u16 block_ack_param_set;
548549

549550
dev_dbg(priv->adapter->dev, "cmd: %s: tid %d\n", __func__, tid);
@@ -554,15 +555,18 @@ int mwifiex_send_addba(struct mwifiex_private *priv, int tid, u8 *peer_mac)
554555
memcmp(priv->cfg_bssid, peer_mac, ETH_ALEN)) {
555556
struct mwifiex_sta_node *sta_ptr;
556557

558+
spin_lock_irqsave(&priv->sta_list_spinlock, flags);
557559
sta_ptr = mwifiex_get_sta_entry(priv, peer_mac);
558560
if (!sta_ptr) {
559561
dev_warn(priv->adapter->dev,
560562
"BA setup with unknown TDLS peer %pM!\n",
561563
peer_mac);
564+
spin_unlock_irqrestore(&priv->sta_list_spinlock, flags);
562565
return -1;
563566
}
564567
if (sta_ptr->is_11ac_enabled)
565568
tx_win_size = MWIFIEX_11AC_STA_AMPDU_DEF_TXWINSIZE;
569+
spin_unlock_irqrestore(&priv->sta_list_spinlock, flags);
566570
}
567571

568572
block_ack_param_set = (u16)((tid << BLOCKACKPARAM_TID_POS) |

drivers/net/wireless/mwifiex/11n_rxreorder.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ mwifiex_11n_create_rx_reorder_tbl(struct mwifiex_private *priv, u8 *ta,
351351
new_node->init_win = seq_num;
352352
new_node->flags = 0;
353353

354+
spin_lock_irqsave(&priv->sta_list_spinlock, flags);
354355
if (mwifiex_queuing_ra_based(priv)) {
355356
dev_dbg(priv->adapter->dev,
356357
"info: AP/ADHOC:last_seq=%d start_win=%d\n",
@@ -367,6 +368,7 @@ mwifiex_11n_create_rx_reorder_tbl(struct mwifiex_private *priv, u8 *ta,
367368
else
368369
last_seq = priv->rx_seq[tid];
369370
}
371+
spin_unlock_irqrestore(&priv->sta_list_spinlock, flags);
370372

371373
if (last_seq != MWIFIEX_DEF_11N_RX_SEQ_NUM &&
372374
last_seq >= new_node->start_win) {
@@ -455,22 +457,26 @@ int mwifiex_cmd_11n_addba_rsp_gen(struct mwifiex_private *priv,
455457
u32 rx_win_size = priv->add_ba_param.rx_win_size;
456458
u8 tid;
457459
int win_size;
460+
unsigned long flags;
458461
uint16_t block_ack_param_set;
459462

460463
if ((GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA) &&
461464
ISSUPP_TDLS_ENABLED(priv->adapter->fw_cap_info) &&
462465
priv->adapter->is_hw_11ac_capable &&
463466
memcmp(priv->cfg_bssid, cmd_addba_req->peer_mac_addr, ETH_ALEN)) {
467+
spin_lock_irqsave(&priv->sta_list_spinlock, flags);
464468
sta_ptr = mwifiex_get_sta_entry(priv,
465469
cmd_addba_req->peer_mac_addr);
466470
if (!sta_ptr) {
467471
dev_warn(priv->adapter->dev,
468472
"BA setup with unknown TDLS peer %pM!\n",
469473
cmd_addba_req->peer_mac_addr);
474+
spin_unlock_irqrestore(&priv->sta_list_spinlock, flags);
470475
return -1;
471476
}
472477
if (sta_ptr->is_11ac_enabled)
473478
rx_win_size = MWIFIEX_11AC_STA_AMPDU_DEF_RXWINSIZE;
479+
spin_unlock_irqrestore(&priv->sta_list_spinlock, flags);
474480
}
475481

476482
cmd->command = cpu_to_le16(HostCmd_CMD_11N_ADDBA_RSP);

drivers/net/wireless/mwifiex/uap_txrx.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ int mwifiex_process_uap_rx_packet(struct mwifiex_private *priv,
266266
struct rx_packet_hdr *rx_pkt_hdr;
267267
u16 rx_pkt_type;
268268
u8 ta[ETH_ALEN], pkt_type;
269+
unsigned long flags;
269270
struct mwifiex_sta_node *node;
270271

271272
uap_rx_pd = (struct uap_rxpd *)(skb->data);
@@ -294,10 +295,12 @@ int mwifiex_process_uap_rx_packet(struct mwifiex_private *priv,
294295
memcpy(ta, rx_pkt_hdr->eth803_hdr.h_source, ETH_ALEN);
295296

296297
if (rx_pkt_type != PKT_TYPE_BAR && uap_rx_pd->priority < MAX_NUM_TID) {
298+
spin_lock_irqsave(&priv->sta_list_spinlock, flags);
297299
node = mwifiex_get_sta_entry(priv, ta);
298300
if (node)
299301
node->rx_seq[uap_rx_pd->priority] =
300302
le16_to_cpu(uap_rx_pd->seq_num);
303+
spin_unlock_irqrestore(&priv->sta_list_spinlock, flags);
301304
}
302305

303306
if (!priv->ap_11n_enabled ||

drivers/net/wireless/mwifiex/wmm.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,6 @@ void mwifiex_ralist_add(struct mwifiex_private *priv, const u8 *ra)
147147
struct mwifiex_sta_node *node;
148148
unsigned long flags;
149149

150-
spin_lock_irqsave(&priv->sta_list_spinlock, flags);
151-
node = mwifiex_get_sta_entry(priv, ra);
152-
spin_unlock_irqrestore(&priv->sta_list_spinlock, flags);
153150

154151
for (i = 0; i < MAX_NUM_TID; ++i) {
155152
ra_list = mwifiex_wmm_allocate_ralist_node(adapter, ra);
@@ -170,10 +167,13 @@ void mwifiex_ralist_add(struct mwifiex_private *priv, const u8 *ra)
170167
ra_list->is_11n_enabled = IS_11N_ENABLED(priv);
171168
}
172169
} else {
170+
spin_lock_irqsave(&priv->sta_list_spinlock, flags);
171+
node = mwifiex_get_sta_entry(priv, ra);
173172
ra_list->is_11n_enabled =
174173
mwifiex_is_sta_11n_enabled(priv, node);
175174
if (ra_list->is_11n_enabled)
176175
ra_list->max_amsdu = node->max_amsdu;
176+
spin_unlock_irqrestore(&priv->sta_list_spinlock, flags);
177177
}
178178

179179
dev_dbg(adapter->dev, "data: ralist %p: is_11n_enabled=%d\n",

0 commit comments

Comments
 (0)