From: Francesco Dolcini <francesco@dolcini.it>
To: "HE WEI (ギカク)" <skyexpoc@gmail.com>
Cc: Brian Norris <briannorris@chromium.org>,
Francesco Dolcini <francesco@dolcini.it>,
Miri Korenblit <miriam.rachel.korenblit@intel.com>,
Johannes Berg <johannes.berg@intel.com>,
Kalle Valo <kvalo@kernel.org>, Kees Cook <kees@kernel.org>,
linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] wifi: mwifiex: bound uAP association event IEs to the event buffer
Date: Wed, 15 Jul 2026 15:22:34 +0200 [thread overview]
Message-ID: <20260715132234.GA56330@francesco-nb> (raw)
In-Reply-To: <20260629120333.94222-1-skyexpoc@gmail.com>
On Mon, Jun 29, 2026 at 09:03:33PM +0900, HE WEI (ギカク) wrote:
> mwifiex_process_uap_event() handles EVENT_UAP_STA_ASSOC by exposing the
> (re)association request IEs that the firmware copies into the event:
>
> sinfo->assoc_req_ies = &event->data[len];
> len = (u8 *)sinfo->assoc_req_ies - (u8 *)&event->frame_control;
> sinfo->assoc_req_ies_len = le16_to_cpu(event->len) - (u16)len;
>
> event->len is supplied by the device firmware and is never validated,
Why not validating event->len instead, when we receive an MWIFIEX_TYPE_EVENT
from the firmware? we could just add a new, validated, u16 event_len, in struct
mwifiex_adapter and after that we can just use it in the code.
and we reject invalid events as soon as possible in the software.
> Fixes: e568634ae7ac ("mwifiex: add AP event handling framework")
> Signed-off-by: HE WEI (ギカク) <skyexpoc@gmail.com>
> ---
> .../net/wireless/marvell/mwifiex/uap_event.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/drivers/net/wireless/marvell/mwifiex/uap_event.c b/drivers/net/wireless/marvell/mwifiex/uap_event.c
> index 679fdae0f001..adca7da29f0f 100644
> --- a/drivers/net/wireless/marvell/mwifiex/uap_event.c
> +++ b/drivers/net/wireless/marvell/mwifiex/uap_event.c
> @@ -126,6 +126,24 @@ int mwifiex_process_uap_event(struct mwifiex_private *priv)
> sinfo->assoc_req_ies = &event->data[len];
> len = (u8 *)sinfo->assoc_req_ies -
> (u8 *)&event->frame_control;
> +
> + /*
> + * event->len is reported by the device firmware and is not
> + * otherwise validated. Reject a length that underflows the
> + * header, or that would place the association request IEs
> + * outside the fixed-size event_body[] buffer the event was
> + * copied into; otherwise the IE walk in
> + * mwifiex_set_sta_ht_cap() reads past event_body and out
> + * of the adapter slab object.
> + */
> + if (le16_to_cpu(event->len) < len ||
> + (u8 *)&event->frame_control + le16_to_cpu(event->len) >
> + adapter->event_body + MAX_EVENT_SIZE) {
> + mwifiex_dbg(adapter, ERROR,
> + "invalid STA assoc event length\n");
> + kfree(sinfo);
> + return -1;
> + }
In case we want to keep the change here, I would ask you to make the
code slighly more compact.
just define a
evt_len = le16_to_cpu(event->len)
and use it.
next prev parent reply other threads:[~2026-07-15 13:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-29 12:03 [PATCH] wifi: mwifiex: bound uAP association event IEs to the event buffer HE WEI (ギカク)
2026-07-10 7:21 ` Francesco Dolcini
2026-07-10 7:41 ` Johannes Berg
2026-07-10 10:44 ` skyexpoc
2026-07-10 14:23 ` Francesco Dolcini
2026-07-15 13:22 ` Francesco Dolcini [this message]
2026-07-15 13:38 ` HE WEI(ギカク)
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=20260715132234.GA56330@francesco-nb \
--to=francesco@dolcini.it \
--cc=briannorris@chromium.org \
--cc=johannes.berg@intel.com \
--cc=kees@kernel.org \
--cc=kvalo@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=miriam.rachel.korenblit@intel.com \
--cc=skyexpoc@gmail.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