linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mac80211: always account for A-MSDU header changes
@ 2018-08-30  8:55 Johannes Berg
  2018-08-30  9:04 ` Lorenzo Bianconi
  0 siblings, 1 reply; 2+ messages in thread
From: Johannes Berg @ 2018-08-30  8:55 UTC (permalink / raw)
  To: linux-wireless; +Cc: Lorenzo Bianconi, Johannes Berg

From: Johannes Berg <johannes.berg@intel.com>

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>
---
 net/mac80211/tx.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 1aac5e3c7eee..6ca0865de945 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -3239,7 +3239,7 @@ static bool ieee80211_amsdu_aggregate(struct ieee80211_sub_if_data *sdata,
 
 	if (!ieee80211_amsdu_realloc_pad(local, skb, sizeof(rfc1042_header) +
 						     2 + pad))
-		goto out;
+		goto out_recalc;
 
 	ret = true;
 	data = skb_push(skb, ETH_ALEN + 2);
@@ -3256,11 +3256,13 @@ static bool ieee80211_amsdu_aggregate(struct ieee80211_sub_if_data *sdata,
 	head->data_len += skb->len;
 	*frag_tail = skb;
 
-	flow->backlog += head->len - orig_len;
-	tin->backlog_bytes += head->len - orig_len;
-
-	fq_recalc_backlog(fq, tin, flow);
+out_recalc:
+	if (head->len != orig_len) {
+		flow->backlog += head->len - orig_len;
+		tin->backlog_bytes += head->len - orig_len;
 
+		fq_recalc_backlog(fq, tin, flow);
+	}
 out:
 	spin_unlock_bh(&fq->lock);
 
-- 
2.14.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] mac80211: always account for A-MSDU header changes
  2018-08-30  8:55 [PATCH] mac80211: always account for A-MSDU header changes Johannes Berg
@ 2018-08-30  9:04 ` Lorenzo Bianconi
  0 siblings, 0 replies; 2+ messages in thread
From: Lorenzo Bianconi @ 2018-08-30  9:04 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, Johannes Berg

> From: Johannes Berg <johannes.berg@intel.com>
> 
> 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>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-08-30 13:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-30  8:55 [PATCH] mac80211: always account for A-MSDU header changes Johannes Berg
2018-08-30  9:04 ` Lorenzo Bianconi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).