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>
This commit is contained in:
Yogesh Ashok Powar 2011-06-06 14:53:02 +05:30 committed by John W. Linville
parent a8fe32937e
commit fb3c19bc96
1 changed files with 14 additions and 8 deletions

View File

@ -185,16 +185,15 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv,
tx_info_aggr->bss_index = tx_info_src->bss_index; tx_info_aggr->bss_index = tx_info_src->bss_index;
skb_aggr->priority = skb_src->priority; skb_aggr->priority = skb_src->priority;
while (skb_src && ((skb_headroom(skb_aggr) + skb_src->len do {
+ LLC_SNAP_LEN) /* Check if AMSDU can accommodate this MSDU */
<= adapter->tx_buf_size)) { if (skb_tailroom(skb_aggr) < (skb_src->len + LLC_SNAP_LEN))
break;
skb_src = skb_dequeue(&pra_list->skb_head); skb_src = skb_dequeue(&pra_list->skb_head);
if (skb_src) { pra_list->total_pkts_size -= skb_src->len;
pra_list->total_pkts_size -= skb_src->len; pra_list->total_pkts--;
pra_list->total_pkts--;
}
atomic_dec(&priv->wmm.tx_pkts_queued); atomic_dec(&priv->wmm.tx_pkts_queued);
@ -212,8 +211,15 @@ mwifiex_11n_aggregate_pkt(struct mwifiex_private *priv,
return -1; return -1;
} }
if (skb_tailroom(skb_aggr) < pad) {
pad = 0;
break;
}
skb_put(skb_aggr, pad);
skb_src = skb_peek(&pra_list->skb_head); skb_src = skb_peek(&pra_list->skb_head);
}
} while (skb_src);
spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, ra_list_flags); spin_unlock_irqrestore(&priv->wmm.ra_list_spinlock, ra_list_flags);