Commit 0d66ce6878690b600bf03ad1bfa9ebf5c043b778

Authored by Johannes Berg
Committed by Greg Kroah-Hartman
1 parent 2592adfe32

mac80211: always account for A-MSDU header changes

[ Upstream commit aa58acf325b4aadeecae2bfc90658273b47dbace ]

In the error path of changing the SKB headroom of the second
A-MSDU subframe, we would not account for the already-changed
length of the first frame that just got converted to be in
A-MSDU format and thus is a bit longer now.

Fix this by doing the necessary accounting.

It would be possible to reorder the operations, but that would
make the code more complex (to calculate the necessary pad),
and the headroom expansion should not fail frequently enough
to make that worthwhile.

Fixes: 6e0456b54545 ("mac80211: add A-MSDU tx support")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Acked-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Showing 1 changed file with 7 additions and 5 deletions Side-by-side Diff

... ... @@ -3188,7 +3188,7 @@
3188 3188  
3189 3189 if (!ieee80211_amsdu_realloc_pad(local, skb, sizeof(rfc1042_header) +
3190 3190 2 + pad))
3191   - goto out;
  3191 + goto out_recalc;
3192 3192  
3193 3193 ret = true;
3194 3194 data = skb_push(skb, ETH_ALEN + 2);
3195 3195  
... ... @@ -3205,11 +3205,13 @@
3205 3205 head->data_len += skb->len;
3206 3206 *frag_tail = skb;
3207 3207  
3208   - flow->backlog += head->len - orig_len;
3209   - tin->backlog_bytes += head->len - orig_len;
  3208 +out_recalc:
  3209 + if (head->len != orig_len) {
  3210 + flow->backlog += head->len - orig_len;
  3211 + tin->backlog_bytes += head->len - orig_len;
3210 3212  
3211   - fq_recalc_backlog(fq, tin, flow);
3212   -
  3213 + fq_recalc_backlog(fq, tin, flow);
  3214 + }
3213 3215 out:
3214 3216 spin_unlock_bh(&fq->lock);
3215 3217