Skip to content

Commit 98f0b0a

Browse files
Ron Rindjunskydavem330
authored andcommitted
mac80211: pass in PS_POLL frames
This patch fixes should_drop_frame function to pass in ps poll control frames required for power save functioanlity. Interface types that do not have interest for PS POLL frames now drop it in handler. Signed-off-by: Ron Rindjunsky <[email protected]> Acked-by: Johannes Berg <[email protected]> Signed-off-by: John W. Linville <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent d647b36 commit 98f0b0a

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

net/mac80211/rx.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,10 @@ static inline int should_drop_frame(struct ieee80211_rx_status *status,
6161
return 1;
6262
if (unlikely(skb->len < 16 + present_fcs_len + radiotap_len))
6363
return 1;
64-
if ((hdr->frame_control & cpu_to_le16(IEEE80211_FCTL_FTYPE)) ==
65-
cpu_to_le16(IEEE80211_FTYPE_CTL))
64+
if (((hdr->frame_control & cpu_to_le16(IEEE80211_FCTL_FTYPE)) ==
65+
cpu_to_le16(IEEE80211_FTYPE_CTL)) &&
66+
((hdr->frame_control & cpu_to_le16(IEEE80211_FCTL_STYPE)) !=
67+
cpu_to_le16(IEEE80211_STYPE_PSPOLL)))
6668
return 1;
6769
return 0;
6870
}
@@ -896,6 +898,7 @@ ieee80211_rx_h_defragment(struct ieee80211_txrx_data *rx)
896898
static ieee80211_txrx_result
897899
ieee80211_rx_h_ps_poll(struct ieee80211_txrx_data *rx)
898900
{
901+
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(rx->dev);
899902
struct sk_buff *skb;
900903
int no_pending_pkts;
901904
DECLARE_MAC_BUF(mac);
@@ -906,6 +909,10 @@ ieee80211_rx_h_ps_poll(struct ieee80211_txrx_data *rx)
906909
!(rx->flags & IEEE80211_TXRXD_RXRA_MATCH)))
907910
return TXRX_CONTINUE;
908911

912+
if ((sdata->type != IEEE80211_IF_TYPE_AP) &&
913+
(sdata->type != IEEE80211_IF_TYPE_VLAN))
914+
return TXRX_DROP;
915+
909916
skb = skb_dequeue(&rx->sta->tx_filtered);
910917
if (!skb) {
911918
skb = skb_dequeue(&rx->sta->ps_tx_buf);

net/mac80211/util.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,16 @@ u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len)
135135
{
136136
u16 fc;
137137

138-
if (len < 24)
138+
/* drop ACK/CTS frames and incorrect hdr len (ctrl) */
139+
if (len < 16)
139140
return NULL;
140141

141142
fc = le16_to_cpu(hdr->frame_control);
142143

143144
switch (fc & IEEE80211_FCTL_FTYPE) {
144145
case IEEE80211_FTYPE_DATA:
146+
if (len < 24) /* drop incorrect hdr len (data) */
147+
return NULL;
145148
switch (fc & (IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) {
146149
case IEEE80211_FCTL_TODS:
147150
return hdr->addr1;
@@ -154,6 +157,8 @@ u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len)
154157
}
155158
break;
156159
case IEEE80211_FTYPE_MGMT:
160+
if (len < 24) /* drop incorrect hdr len (mgmt) */
161+
return NULL;
157162
return hdr->addr3;
158163
case IEEE80211_FTYPE_CTL:
159164
if ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_PSPOLL)

0 commit comments

Comments
 (0)