mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christian Lamparter <chunkeey@gmail.com>
To: Shengzhuo Wei <me@cherr.cc>,
	Christian Lamparter <chunkeey@googlemail.com>,
	Michael Wu <flamingice@sourmilk.net>,
	"John W. Linville" <linville@tuxdriver.com>,
	"David S. Miller" <davem@davemloft.net>
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH 1/2] wifi: p54: validate curve data length in p54_parse_eeprom()
Date: Sun, 30 Aug 2026 15:16:44 +0200	[thread overview]
Message-ID: <aa32505d-f756-40d2-88bb-cd31470f4eb3@gmail.com> (raw)
In-Reply-To: <20260827-p54-pda-validation-v1-1-bdc2b0675056@cherr.cc>

Hi,

On 8/26/26 7:07 PM, Shengzhuo Wei wrote:
> p54_convert_rev0() and p54_convert_rev1() walk
> channels * (2 + points_per_channel * sizeof(sample)) bytes of the
> curve data entry, with both counts taken verbatim from the
> device-supplied EEPROM. An entry that declares channels=255,
> points_per_channel=255 but carries only the 4-byte header drives a
> ~191 KB slab-out-of-bounds read past the EEPROM buffer (verified with
> a KASAN reproducer of the conversion loop). The sibling converters
> p54_convert_output_limits() and p54_convert_db() already validate
> their counts against the entry length; this path was missed.
> 
> Reject the entry when the counts do not fit in the entry data.
> 
> Fixes: eff1a59c48e3 ("[P54]: add mac80211-based driver for prism54 softmac hardware")
> Cc: stable@vger.kernel.org
> Assisted-by: GLM:5.3
> Signed-off-by: Shengzhuo Wei <me@cherr.cc>
> ---
>   drivers/net/wireless/intersil/p54/eeprom.c | 16 ++++++++++++++++
>   1 file changed, 16 insertions(+)
> 
> diff --git a/drivers/net/wireless/intersil/p54/eeprom.c b/drivers/net/wireless/intersil/p54/eeprom.c
> index 95580921d933827c5eac55b79404e26bd7a57ba4..968ce9a411358e0e6b83117b1a077becc3207090 100644
> --- a/drivers/net/wireless/intersil/p54/eeprom.c
> +++ b/drivers/net/wireless/intersil/p54/eeprom.c
> @@ -763,6 +763,8 @@ int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len)
>   		case PDR_PRISM_PA_CAL_CURVE_DATA: {
>   			struct pda_pa_curve_data *curve_data =
>   				(struct pda_pa_curve_data *)entry->data;
> +			size_t needed;
> +
>   			if (data_len < sizeof(*curve_data)) {
>   				err = -EINVAL;
>   				goto err;
> @@ -770,9 +772,23 @@ int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len)
>   
>   			switch (curve_data->cal_method_rev) {
>   			case 0:
> +				needed = curve_data->channels *
> +					(sizeof(struct pda_pa_curve_data_sample_rev0) *
> +					 curve_data->points_per_channel + 2);
> +				if (data_len - sizeof(*curve_data) < needed) {
> +					err = -EINVAL;
> +					goto err;
> +				}
>   				err = p54_convert_rev0(dev, curve_data);
>   				break;
>   			case 1:
> +				needed = curve_data->channels *
> +					(sizeof(struct pda_pa_curve_data_sample_rev1) *
> +					 curve_data->points_per_channel + 3);
> +				if (data_len - sizeof(*curve_data) < needed) {
> +					err = -EINVAL;
> +					goto err;
> +				}
>   				err = p54_convert_rev1(dev, curve_data);

please move the checks into p54_convert_rev0 / p54_convert_rev1.

Cheers,
Christian

  reply	other threads:[~2026-08-30 13:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-26 17:07 [PATCH 0/2] wifi: p54: validate PDA entry data lengths in eeprom parser Shengzhuo Wei
2026-08-26 17:07 ` [PATCH 1/2] wifi: p54: validate curve data length in p54_parse_eeprom() Shengzhuo Wei
2026-08-30 13:16   ` Christian Lamparter [this message]
2026-08-26 17:07 ` [PATCH 2/2] wifi: p54: require a full exp_if record in PDR_INTERFACE_LIST Shengzhuo Wei
2026-08-30 13:18   ` Christian Lamparter

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=aa32505d-f756-40d2-88bb-cd31470f4eb3@gmail.com \
    --to=chunkeey@gmail.com \
    --cc=chunkeey@googlemail.com \
    --cc=davem@davemloft.net \
    --cc=flamingice@sourmilk.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=me@cherr.cc \
    --cc=stable@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®