Linux wireless drivers development
 help / color / mirror / Atom feed
From: Heyang Tan <thy15333007817@163.com>
To: linux-wireless@vger.kernel.org
Cc: stf_xl@wp.pl
Subject: [PATCH] wifi: rt2x00: rt61pci: trim RX skb to reported frame length
Date: Fri, 16 Oct 2026 11:57:06 +0800	[thread overview]
Message-ID: <20261016035706.1706-1-thy15333007817@163.com> (raw)

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.
+	 */
+	skb_trim(entry->skb, rxdesc->size);
 }
 
 /*

-- 
2.34.1


             reply	other threads:[~2026-10-16  3:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-16  3:57 Heyang Tan [this message]
2026-10-16  7:28 ` [PATCH] wifi: rt2x00: rt61pci: trim RX skb to reported frame length Stanislaw Gruszka
  -- strict thread matches above, loose matches on Subject: below --
2026-10-19  7:33 Heyang Tan

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=20261016035706.1706-1-thy15333007817@163.com \
    --to=thy15333007817@163.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=stf_xl@wp.pl \
    /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