diff options
author | Yogesh Ashok Powar <yogeshp@marvell.com> | 2011-06-06 05:23:02 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-06-07 14:44:03 -0400 |
commit | fb3c19bc9687d972b83faf366b38ac807eca8f25 (patch) | |
tree | 0426abe754c359684ca5d0e567395015934a717a /drivers/net/wireless/mwifiex/11n_aggr.c | |
parent | a8fe32937e4e55c9ed73c79800198d137a1b968a (diff) |
mwifiex: adding check for enough space before padding
All MSDUs, except the last one in an AMSDU, should end up at 4
bytes boundary. There is need to check if enough skb_tailroom
space exists before padding the skb.
Also re-arranging code for better readablity.
Signed-off-by: Yogesh Ashok Powar <yogeshp@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/mwifiex/11n_aggr.c')
-rw-r--r-- | drivers/net/wireless/mwifiex/11n_aggr.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/net/wireless/mwifiex/11n_aggr.c b/drivers/net/wireless/mwifiex/11n_aggr.c index aee3491f61d5..25312e4437f5 100644 --- a/drivers/net/wireless/mwifiex/11n_aggr.c +++ b/drivers/net/wireless/mwifiex/11n_aggr.c | |||
@@ -185,16 +185,15 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv, | |||
185 | tx_info_aggr->bss_index = tx_info_src->bss_index; | 185 | tx_info_aggr->bss_index = tx_info_src->bss_index; |
186 | skb_aggr->priority = skb_src->priority; | 186 | skb_aggr->priority = skb_src->priority; |
187 | 187 | ||
188 | while (skb_src && ((skb_headroom(skb_aggr) + skb_src->len | 188 | do { |
189 | + LLC_SNAP_LEN) | 189 | /* Check if AMSDU can accommodate this MSDU */ |
190 | <= adapter->tx_buf_size)) { | 190 | if (skb_tailroom(skb_aggr) < (skb_src->len + LLC_SNAP_LEN)) |
191 | break; | ||
191 | 192 | ||
192 | skb_src = skb_dequeue(&pra_list->skb_head); | 193 | skb_src = skb_dequeue(&pra_list->skb_head); |
193 | 194 | ||
194 | if (skb_src) { | 195 | pra_list->total_pkts_size -= skb_src->len; |
195 | pra_list->total_pkts_size -= skb_src->len; | 196 | pra_list->total_pkts--; |
196 | pra_list->total_pkts--; | ||
197 | } | ||
198 | 197 | ||
199 | atomic_dec(&priv->wmm.tx_pkts_queued); | 198 | atomic_dec(&priv->wmm.tx_pkts_queued); |
200 | 199 | ||
@@ -212,8 +211,15 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv, | |||
212 | return -1; | 211 | return -1; |
213 | } | 212 | } |
214 | 213 | ||
214 | if (skb_tailroom(skb_aggr) < pad) { | ||
215 | pad = 0; | ||
216 | break; | ||
217 | } | ||
218 | skb_put(skb_aggr, pad); | ||
219 | |||
215 | skb_src = skb_peek(&pra_list->skb_head); | 220 | skb_src = skb_peek(&pra_list->skb_head); |
216 | } | 221 | |
222 | } while (skb_src); | ||
217 | 223 | ||
218 | spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, ra_list_flags); | 224 | spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, ra_list_flags); |
219 | 225 | ||