From: Stanislaw Gruszka <stf_xl@wp.pl>
To: Heyang Tan <thy15333007817@163.com>
Cc: linux-wireless@vger.kernel.org
Subject: Re: [PATCH] wifi: rt2x00: rt61pci: trim RX skb to reported frame length
Date: Fri, 16 Oct 2026 09:28:51 +0200 [thread overview]
Message-ID: <20261016072851.GA70242@wp.pl> (raw)
In-Reply-To: <20261016035706.1706-1-thy15333007817@163.com>
On Fri, Oct 16, 2026 at 11:57:06AM +0800, Heyang Tan wrote:
> rt61pci_fill_rxdone() reports rxdesc.size from the 12-bit
> DATABYTE_COUNT field but, unlike the USB drivers, does not trim the skb
> to that length. rt2x00lib_rxdone() then computes the 802.11 header
> length from the untrimmed skb and can call rt2x00crypto_rx_insert_iv()
> while skb->len does not match rxdesc.size.
>
> Trim the skb at the end of rt61pci_fill_rxdone(), matching rt2500usb and
> rt73usb, so the skb length is correct before the header length is
> computed and before any IV/ICV data is reinserted.
>
> Signed-off-by: Heyang Tan <thy15333007817@163.com>
> ---
> drivers/net/wireless/ralink/rt2x00/rt61pci.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/drivers/net/wireless/ralink/rt2x00/rt61pci.c b/drivers/net/wireless/ralink/rt2x00/rt61pci.c
> index d4783658b..b2ee0cc14 100644
> --- a/drivers/net/wireless/ralink/rt2x00/rt61pci.c
> +++ b/drivers/net/wireless/ralink/rt2x00/rt61pci.c
> @@ -2051,6 +2051,14 @@ static void rt61pci_fill_rxdone(struct queue_entry *entry,
> rxdesc->dev_flags |= RXDONE_SIGNAL_BITRATE;
> if (rt2x00_get_field32(word0, RXD_W0_MY_BSS))
> rxdesc->dev_flags |= RXDONE_MY_BSS;
> +
> + /*
> + * Trim the skb to the reported frame length. rt2x00lib_rxdone()
> + * computes the 802.11 header length from the skb before calling
> + * rt2x00crypto_rx_insert_iv(), and that function requires skb->len
> + * to match rxdesc.size.
> + */
We don't need this comment IMHO.
> + skb_trim(entry->skb, rxdesc->size);
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>
Regards
Stanislaw
prev parent reply other threads:[~2026-10-16 7:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 3:57 [PATCH] wifi: rt2x00: rt61pci: trim RX skb to reported frame length Heyang Tan
2026-10-16 7:28 ` Stanislaw Gruszka [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=20261016072851.GA70242@wp.pl \
--to=stf_xl@wp.pl \
--cc=linux-wireless@vger.kernel.org \
--cc=thy15333007817@163.com \
/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