* [PATCH 1/2] mac80211: Fix ieee80211_amsdu_aggregate frag_tail bug
@ 2021-08-16 8:51 Ping-Ke Shih
2021-08-16 8:51 ` [PATCH 2/2] mac80211: Fix insufficient headroom issue for AMSDU Ping-Ke Shih
2021-08-16 12:22 ` [PATCH 1/2] mac80211: Fix ieee80211_amsdu_aggregate frag_tail bug Felix Fietkau
0 siblings, 2 replies; 4+ messages in thread
From: Ping-Ke Shih @ 2021-08-16 8:51 UTC (permalink / raw)
To: johannes; +Cc: linux-wireless, gary.chang
From: Chih-Kang Chang <gary.chang@realtek.com>
In ieee80211_amsdu_aggregate() set a pointer frag_tail point to the
end of skb_shinfo(head)->frag_list, and use it to bind other skb in
the end of this function. But when execute ieee80211_amsdu_aggregate()
->ieee80211_amsdu_realloc_pad()->pskb_expand_head(), the address of
skb_shinfo(head)->frag_list will be changed. However, the
ieee80211_amsdu_aggregate() not update frag_tail after call
pskb_expand_head(). That will cause the second skb can't bind to the
head skb appropriately.So we update the address of frag_tail to fix it.
Fixes: 6e0456b54545 ("mac80211: add A-MSDU tx support")
Signed-off-by: Chih-Kang Chang <gary.chang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
net/mac80211/tx.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 8509778ff31f..9e0d4fca1c76 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -3406,6 +3406,12 @@ static bool ieee80211_amsdu_aggregate(struct ieee80211_sub_if_data *sdata,
head->len += skb->len;
head->data_len += skb->len;
+
+ /* frag_list should be updated after pskb_expand_head() */
+ frag_tail = &skb_shinfo(head)->frag_list;
+ while (*frag_tail)
+ frag_tail = &(*frag_tail)->next;
+
*frag_tail = skb;
out_recalc:
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] mac80211: Fix insufficient headroom issue for AMSDU
2021-08-16 8:51 [PATCH 1/2] mac80211: Fix ieee80211_amsdu_aggregate frag_tail bug Ping-Ke Shih
@ 2021-08-16 8:51 ` Ping-Ke Shih
2021-08-16 12:22 ` [PATCH 1/2] mac80211: Fix ieee80211_amsdu_aggregate frag_tail bug Felix Fietkau
1 sibling, 0 replies; 4+ messages in thread
From: Ping-Ke Shih @ 2021-08-16 8:51 UTC (permalink / raw)
To: johannes; +Cc: linux-wireless, gary.chang
From: Chih-Kang Chang <gary.chang@realtek.com>
ieee80211_amsdu_realloc_pad() lacks some check for extra_tx_headroom,
the original reserved headroom might be eaten. So we add the
extra_tx_headroom check.
Fixes: 6e0456b54545 ("mac80211: add A-MSDU tx support")
Signed-off-by: Chih-Kang Chang <gary.chang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
---
net/mac80211/tx.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 9e0d4fca1c76..a69dc58d9768 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -3242,7 +3242,8 @@ static bool ieee80211_amsdu_prepare_head(struct ieee80211_sub_if_data *sdata,
if (info->control.flags & IEEE80211_TX_CTRL_AMSDU)
return true;
- if (!ieee80211_amsdu_realloc_pad(local, skb, sizeof(*amsdu_hdr)))
+ if (!ieee80211_amsdu_realloc_pad(local, skb, sizeof(*amsdu_hdr) +
+ local->hw.extra_tx_headroom))
return false;
data = skb_push(skb, sizeof(*amsdu_hdr));
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] mac80211: Fix ieee80211_amsdu_aggregate frag_tail bug
2021-08-16 8:51 [PATCH 1/2] mac80211: Fix ieee80211_amsdu_aggregate frag_tail bug Ping-Ke Shih
2021-08-16 8:51 ` [PATCH 2/2] mac80211: Fix insufficient headroom issue for AMSDU Ping-Ke Shih
@ 2021-08-16 12:22 ` Felix Fietkau
2021-08-30 6:27 ` Pkshih
1 sibling, 1 reply; 4+ messages in thread
From: Felix Fietkau @ 2021-08-16 12:22 UTC (permalink / raw)
To: Ping-Ke Shih, johannes; +Cc: linux-wireless, gary.chang
On 2021-08-16 10:51, Ping-Ke Shih wrote:
> From: Chih-Kang Chang <gary.chang@realtek.com>
>
> In ieee80211_amsdu_aggregate() set a pointer frag_tail point to the
> end of skb_shinfo(head)->frag_list, and use it to bind other skb in
> the end of this function. But when execute ieee80211_amsdu_aggregate()
> ->ieee80211_amsdu_realloc_pad()->pskb_expand_head(), the address of
> skb_shinfo(head)->frag_list will be changed. However, the
> ieee80211_amsdu_aggregate() not update frag_tail after call
> pskb_expand_head(). That will cause the second skb can't bind to the
> head skb appropriately.So we update the address of frag_tail to fix it.
I think instead of iterating over fragments a second time, we should
move the ieee80211_amsdu_prepare_head call further up.
- Felix
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH 1/2] mac80211: Fix ieee80211_amsdu_aggregate frag_tail bug
2021-08-16 12:22 ` [PATCH 1/2] mac80211: Fix ieee80211_amsdu_aggregate frag_tail bug Felix Fietkau
@ 2021-08-30 6:27 ` Pkshih
0 siblings, 0 replies; 4+ messages in thread
From: Pkshih @ 2021-08-30 6:27 UTC (permalink / raw)
To: Felix Fietkau, johannes; +Cc: linux-wireless, Gary Chang
> -----Original Message-----
> From: Felix Fietkau [mailto:nbd@nbd.name]
> Sent: Monday, August 16, 2021 8:23 PM
> To: Pkshih; johannes@sipsolutions.net
> Cc: linux-wireless@vger.kernel.org; Gary Chang
> Subject: Re: [PATCH 1/2] mac80211: Fix ieee80211_amsdu_aggregate frag_tail bug
>
> On 2021-08-16 10:51, Ping-Ke Shih wrote:
> > From: Chih-Kang Chang <gary.chang@realtek.com>
> >
> > In ieee80211_amsdu_aggregate() set a pointer frag_tail point to the
> > end of skb_shinfo(head)->frag_list, and use it to bind other skb in
> > the end of this function. But when execute ieee80211_amsdu_aggregate()
> > ->ieee80211_amsdu_realloc_pad()->pskb_expand_head(), the address of
> > skb_shinfo(head)->frag_list will be changed. However, the
> > ieee80211_amsdu_aggregate() not update frag_tail after call
> > pskb_expand_head(). That will cause the second skb can't bind to the
> > head skb appropriately.So we update the address of frag_tail to fix it.
> I think instead of iterating over fragments a second time, we should
> move the ieee80211_amsdu_prepare_head call further up.
>
The first iteration is used to calculate 'n' and 'nfrags' to decide if
we need to do AMSDU as well as ieee80211_amsdu_prepare_head(), so we
don't have a good idea to move the function upward. However, we have
an alternative idea [1] to fix frag_tail.
[1] https://lore.kernel.org/linux-wireless/20210830061728.10332-1-pkshih@realtek.com/T/#u
--
Ping-Ke
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-08-30 6:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-16 8:51 [PATCH 1/2] mac80211: Fix ieee80211_amsdu_aggregate frag_tail bug Ping-Ke Shih
2021-08-16 8:51 ` [PATCH 2/2] mac80211: Fix insufficient headroom issue for AMSDU Ping-Ke Shih
2021-08-16 12:22 ` [PATCH 1/2] mac80211: Fix ieee80211_amsdu_aggregate frag_tail bug Felix Fietkau
2021-08-30 6:27 ` Pkshih
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).