Linux wireless drivers development
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
To: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
Cc: Jeff Johnson <jjohnson@kernel.org>,
	Carl Huang <quic_cjhuang@quicinc.com>,
	Vasanthakumar Thiagarajan
	<vasanthakumar.thiagarajan@oss.qualcomm.com>,
	Bhagavathi Perumal S <quic_bperumal@quicinc.com>,
	Pradeep Kumar Chitrapu <quic_pradeepc@quicinc.com>,
	Wen Gong <quic_wgong@quicinc.com>,
	P Praneesh <quic_ppranees@quicinc.com>,
	Balamurugan Selvarajan <quic_bselvara@quicinc.com>,
	Kalle Valo <kvalo@kernel.org>,
	linux-wireless@vger.kernel.org, ath12k@lists.infradead.org
Subject: Re: [PATCH ath-next 1/3] wifi: ath12k: validate RX frame length before undecapsulation
Date: Fri, 13 Nov 2026 11:26:38 +0100	[thread overview]
Message-ID: <avbl3iulRGwsfLhR@lore-desk> (raw)
In-Reply-To: <4ae460ec-fe87-44e4-a6d2-e1d7f6391fba@oss.qualcomm.com>

[-- Attachment #1: Type: text/plain, Size: 2931 bytes --]

> 
> 
> On 10/16/2026 11:16 PM, Lorenzo Bianconi wrote:
> > Reject truncated raw frames before removing the FCS trailer. Without this
> > check, subtracting FCS_LEN from a shorter skb underflows and leaves the
> 
> skb_trim() has the check itself, so there will be no underflow?

I agree the commit message is misleading, I think we just need to return an
error in case the skb does not contain the FCS.

> 
> > FCS untrimmed.
> > 
> > Also verify that the frame contains enough data for the 802.11 header and
> > the crypto header before moving the header to make room for the crypto
> > parameters.
> > 
> > Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c7-00108-QCAHMTSWPL_V1.0_V2.0_SILICONZ_UPSTREAM-3
> > 
> > Fixes: d889913205cf ("wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices")
> > Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@oss.qualcomm.com>
> > ---
> >  drivers/net/wireless/ath/ath12k/dp_rx.c       | 46 ++++++++++++++++++---------
> >  drivers/net/wireless/ath/ath12k/dp_rx.h       | 10 +++---
> >  drivers/net/wireless/ath/ath12k/wifi7/dp_rx.c | 22 +++++++++----
> >  3 files changed, 51 insertions(+), 27 deletions(-)
> > 
> > diff --git a/drivers/net/wireless/ath/ath12k/dp_rx.c b/drivers/net/wireless/ath/ath12k/dp_rx.c
> > index 36be543b7c50..40b8da34268f 100644
> > --- a/drivers/net/wireless/ath/ath12k/dp_rx.c
> > +++ b/drivers/net/wireless/ath/ath12k/dp_rx.c
> > @@ -999,11 +999,11 @@ static void ath12k_dp_rx_h_undecap_nwifi(struct ath12k_pdev_dp *dp_pdev,
> >  	memcpy(skb_push(msdu, hdr_len), decap_hdr, hdr_len);
> >  }
> >  
> > -static void ath12k_dp_rx_h_undecap_raw(struct ath12k_pdev_dp *dp_pdev,
> > -				       struct sk_buff *msdu,
> > -				       enum hal_encrypt_type enctype,
> > -				       struct ieee80211_rx_status *status,
> > -				       bool decrypted)
> > +static int ath12k_dp_rx_h_undecap_raw(struct ath12k_pdev_dp *dp_pdev,
> > +				      struct sk_buff *msdu,
> > +				      enum hal_encrypt_type enctype,
> > +				      struct ieee80211_rx_status *status,
> > +				      bool decrypted)
> >  {
> >  	struct ath12k_dp *dp = dp_pdev->dp;
> >  	struct ath12k_skb_rxcb *rxcb = ATH12K_SKB_RXCB(msdu);
> > @@ -1014,13 +1014,16 @@ static void ath12k_dp_rx_h_undecap_raw(struct ath12k_pdev_dp *dp_pdev,
> >  	if (!rxcb->is_first_msdu ||
> >  	    !(rxcb->is_first_msdu && rxcb->is_last_msdu)) {
> >  		WARN_ON_ONCE(1);
> > -		return;
> > +		return 0;
> >  	}
> >  
> > +	if (msdu->len < FCS_LEN)
> > +		return -EINVAL;
> > +
> 
> every later trim in this function has the same problem: msdu->len minus the MIC, ICV or
> MMIC length is not checked either. should we add check for them as well?

ack, I will fix it in v2.

Regards,
Lorenzo

> 
> >  	skb_trim(msdu, msdu->len - FCS_LEN);
> >  
> >  	if (!decrypted)
> > -		return;
> > +		return 0;
> >  
> >  	hdr = (void *)msdu->data;
> >  
> 
> [...]
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2026-11-13 10:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-16 15:16 [PATCH ath-next 0/3] wifi: ath12k: rely on ieee80211_rx_list() to send rx packets to mac80211 Lorenzo Bianconi
2026-10-16 15:16 ` [PATCH ath-next 1/3] wifi: ath12k: validate RX frame length before undecapsulation Lorenzo Bianconi
2026-11-09  5:32   ` Baochen Qiang
2026-11-13 10:26     ` Lorenzo Bianconi [this message]
2026-10-16 15:16 ` [PATCH ath-next 2/3] wifi: ath12k: rely on pskb_trim() to trim the received skb Lorenzo Bianconi
2026-11-09  5:32   ` Baochen Qiang
2026-10-16 15:16 ` [PATCH ath-next 3/3] wifi: ath12k: use ieee80211_rx_list() to deliver packets to mac80211 Lorenzo Bianconi

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=avbl3iulRGwsfLhR@lore-desk \
    --to=lorenzo.bianconi@oss.qualcomm.com \
    --cc=ath12k@lists.infradead.org \
    --cc=baochen.qiang@oss.qualcomm.com \
    --cc=jjohnson@kernel.org \
    --cc=kvalo@kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=quic_bperumal@quicinc.com \
    --cc=quic_bselvara@quicinc.com \
    --cc=quic_cjhuang@quicinc.com \
    --cc=quic_ppranees@quicinc.com \
    --cc=quic_pradeepc@quicinc.com \
    --cc=quic_wgong@quicinc.com \
    --cc=vasanthakumar.thiagarajan@oss.qualcomm.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