linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pkshih <pkshih@realtek.com>
To: Pkshih <pkshih@realtek.com>,
	"johannes@sipsolutions.net" <johannes@sipsolutions.net>
Cc: "linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"nbd@nbd.name" <nbd@nbd.name>,
	Gary Chang <gary.chang@realtek.com>,
	"Kevin Yang" <kevin_yang@realtek.com>
Subject: RE: [PATCH v2] mac80211: Fix ieee80211_amsdu_aggregate frag_tail bug
Date: Mon, 30 Aug 2021 07:38:23 +0000	[thread overview]
Message-ID: <7f1c52fa16aa401297bad21d7c0ecdd6@realtek.com> (raw)
In-Reply-To: <20210830061728.10332-1-pkshih@realtek.com>


> -----Original Message-----
> From: Ping-Ke Shih [mailto:pkshih@realtek.com]
> Sent: Monday, August 30, 2021 2:17 PM
> To: johannes@sipsolutions.net
> Cc: linux-wireless@vger.kernel.org; nbd@nbd.name; Gary Chang; Kevin Yang
> Subject: [PATCH v2] mac80211: Fix ieee80211_amsdu_aggregate frag_tail bug
> 
> 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: Zong-Zhe Yang <kevin_yang@realtek.com>
> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
> ---
> v2: an alternative fix to prevent iterating fragment twice.
> ---
>  net/mac80211/tx.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
> index 2d1193ed3eb5..fb5e43489b62 100644
> --- a/net/mac80211/tx.c
> +++ b/net/mac80211/tx.c
> @@ -3380,6 +3380,13 @@ static bool ieee80211_amsdu_aggregate(struct ieee80211_sub_if_data *sdata,
>  	if (!ieee80211_amsdu_prepare_head(sdata, fast_tx, head))
>  		goto out;
> 
> +       /* While n == 2, frag_tail should be the address of head's frag_list.
> +	* However, head probably re-alloc after ieee80211_amsdu_prepare_head.
> +	* So, re-assign frag_tail again to make sure the correctness.
> +	*/
> +	if (n == 2)
> +		frag_tail = &skb_shinfo(head)->frag_list;
> +

I mess up the coding style and fix it by v3 [1]. Please ignore this patch.

[1] https://lore.kernel.org/linux-wireless/20210830073240.12736-1-pkshih@realtek.com/T/#u

--
Ping-Ke


      reply	other threads:[~2021-08-30  7:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-30  6:17 [PATCH v2] mac80211: Fix ieee80211_amsdu_aggregate frag_tail bug Ping-Ke Shih
2021-08-30  7:38 ` Pkshih [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7f1c52fa16aa401297bad21d7c0ecdd6@realtek.com \
    --to=pkshih@realtek.com \
    --cc=gary.chang@realtek.com \
    --cc=johannes@sipsolutions.net \
    --cc=kevin_yang@realtek.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=nbd@nbd.name \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).