aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/rx.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/rx.c')
-rw-r--r--net/mac80211/rx.c39
1 files changed, 22 insertions, 17 deletions
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 7065fd7e7ba2..c01588f9d453 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -2440,24 +2440,20 @@ static u8 ieee80211_rx_reorder_ampdu(struct ieee80211_local *local,
2440 * This is the receive path handler. It is called by a low level driver when an 2440 * This is the receive path handler. It is called by a low level driver when an
2441 * 802.11 MPDU is received from the hardware. 2441 * 802.11 MPDU is received from the hardware.
2442 */ 2442 */
2443void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb) 2443void ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb)
2444{ 2444{
2445 struct ieee80211_local *local = hw_to_local(hw); 2445 struct ieee80211_local *local = hw_to_local(hw);
2446 struct ieee80211_rate *rate = NULL; 2446 struct ieee80211_rate *rate = NULL;
2447 struct ieee80211_supported_band *sband; 2447 struct ieee80211_supported_band *sband;
2448 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb); 2448 struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
2449 2449
2450 if (status->band < 0 || 2450 if (WARN_ON(status->band < 0 ||
2451 status->band >= IEEE80211_NUM_BANDS) { 2451 status->band >= IEEE80211_NUM_BANDS))
2452 WARN_ON(1); 2452 goto drop;
2453 return;
2454 }
2455 2453
2456 sband = local->hw.wiphy->bands[status->band]; 2454 sband = local->hw.wiphy->bands[status->band];
2457 if (!sband) { 2455 if (WARN_ON(!sband))
2458 WARN_ON(1); 2456 goto drop;
2459 return;
2460 }
2461 2457
2462 /* 2458 /*
2463 * If we're suspending, it is possible although not too likely 2459 * If we're suspending, it is possible although not too likely
@@ -2466,16 +2462,21 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb)
2466 * that might, for example, cause stations to be added or other 2462 * that might, for example, cause stations to be added or other
2467 * driver callbacks be invoked. 2463 * driver callbacks be invoked.
2468 */ 2464 */
2469 if (unlikely(local->quiescing || local->suspended)) { 2465 if (unlikely(local->quiescing || local->suspended))
2470 kfree_skb(skb); 2466 goto drop;
2471 return; 2467
2472 } 2468 /*
2469 * The same happens when we're not even started,
2470 * but that's worth a warning.
2471 */
2472 if (WARN_ON(!local->started))
2473 goto drop;
2473 2474
2474 if (status->flag & RX_FLAG_HT) { 2475 if (status->flag & RX_FLAG_HT) {
2475 /* rate_idx is MCS index */ 2476 /* rate_idx is MCS index */
2476 if (WARN_ON(status->rate_idx < 0 || 2477 if (WARN_ON(status->rate_idx < 0 ||
2477 status->rate_idx >= 76)) 2478 status->rate_idx >= 76))
2478 return; 2479 goto drop;
2479 /* HT rates are not in the table - use the highest legacy rate 2480 /* HT rates are not in the table - use the highest legacy rate
2480 * for now since other parts of mac80211 may not yet be fully 2481 * for now since other parts of mac80211 may not yet be fully
2481 * MCS aware. */ 2482 * MCS aware. */
@@ -2483,7 +2484,7 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb)
2483 } else { 2484 } else {
2484 if (WARN_ON(status->rate_idx < 0 || 2485 if (WARN_ON(status->rate_idx < 0 ||
2485 status->rate_idx >= sband->n_bitrates)) 2486 status->rate_idx >= sband->n_bitrates))
2486 return; 2487 goto drop;
2487 rate = &sband->bitrates[status->rate_idx]; 2488 rate = &sband->bitrates[status->rate_idx];
2488 } 2489 }
2489 2490
@@ -2522,8 +2523,12 @@ void __ieee80211_rx(struct ieee80211_hw *hw, struct sk_buff *skb)
2522 __ieee80211_rx_handle_packet(hw, skb, rate); 2523 __ieee80211_rx_handle_packet(hw, skb, rate);
2523 2524
2524 rcu_read_unlock(); 2525 rcu_read_unlock();
2526
2527 return;
2528 drop:
2529 kfree_skb(skb);
2525} 2530}
2526EXPORT_SYMBOL(__ieee80211_rx); 2531EXPORT_SYMBOL(ieee80211_rx);
2527 2532
2528/* This is a version of the rx handler that can be called from hard irq 2533/* This is a version of the rx handler that can be called from hard irq
2529 * context. Post the skb on the queue and schedule the tasklet */ 2534 * context. Post the skb on the queue and schedule the tasklet */