Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CEEE03E7141; Tue, 21 Jul 2026 17:33:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784655234; cv=none; b=VnnuFhhPgVf5z30OD93FL2so3t1nWHG4jd2LzFvkyGZeGfWR9A4xA3oK1F8BxsSpzF0y75pks2CpSby5fD/zjdZulQZ2MTO6zgY9BCtjpjIhVMXBrBtycnW2M1XdMYFNJT9VtiDXdV39QLgSRze4m8LYme5WJjJijMo6ktReGF4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784655234; c=relaxed/simple; bh=M6QeezxVFi34pm1s36pm+5kNP+eCpr0Li/hebKfdFyA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VDvElxIVt4Ae6sqvpMlyqzlxbPuYayhIfeusPABCiXV3X3SKbtiXiRY/8HrXFPXnLo9nSKorUj1soyFymyKQxSvIUf6lcEu+uNHToJBQyAKb+0/uk2zE0NbY+twmVam2RYvu4r9iTyCgZE9xGbTfJ5390QllrbTSrBHy+RWKM/o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=GGxIBn6r; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="GGxIBn6r" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41F9B1F000E9; Tue, 21 Jul 2026 17:33:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784655232; bh=aMEygpz6ZOVHGW1kEj5nNIuwIBu0TUV3qtT7vSDNleA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=GGxIBn6rWSnidD3myRtRgXRkscuIshMyY2yItTPpEOWQw3Nykos466drItauk4tK9 e1D3NziCifa1J0y+riu/+TmkhKLzOuPGBvbnJTAdOdATk3L7FYhEg1mklcGdhq47s4 KgO3rm+E41BvE0TF7v4OEodEq93p89bZB210Ef6c= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Kaixuan Li , Maoyi Xie , Arend van Spriel , Johannes Berg Subject: [PATCH 7.1 2006/2077] wifi: brcmfmac: cyw: fix heap overflow on a short auth frame Date: Tue, 21 Jul 2026 17:27:59 +0200 Message-ID: <20260721152640.025175280@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152552.646164743@linuxfoundation.org> References: <20260721152552.646164743@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Maoyi Xie commit 240c8d2c717b3f8153e7e877b22a82518d78dbdc upstream. brcmf_notify_auth_frame_rx() takes the frame length from the firmware event and copies the frame body with the management header offset subtracted: u32 mgmt_frame_len = e->datalen - sizeof(struct brcmf_rx_mgmt_data); ... memcpy(&mgmt_frame->u, frame, mgmt_frame_len - offsetof(struct ieee80211_mgmt, u)); The only length check is e->datalen >= sizeof(*rxframe), so mgmt_frame_len can be anything from 0 up. offsetof(struct ieee80211_mgmt, u) is 24. When mgmt_frame_len is below that, the subtraction wraps as an unsigned value to a huge length. The memcpy then runs far past the kzalloc'd buffer. A malicious or malfunctioning AP can make the frame short during the external SAE auth exchange, so this is a remotely triggered heap overflow. Reject frames shorter than the management header offset before the copy. Fixes: 66f909308a7c ("wifi: brcmfmac: cyw: support external SAE authentication in station mode") Link: https://lore.kernel.org/r/178214417708.2368577.16740907093694208834@maoyixie.com Cc: stable@vger.kernel.org Co-developed-by: Kaixuan Li Signed-off-by: Kaixuan Li Signed-off-by: Maoyi Xie Acked-by: Arend van Spriel Link: https://patch.msgid.link/20260627131313.3878893-1-maoyixie.tju@gmail.com Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/core.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/core.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/core.c @@ -293,6 +293,12 @@ brcmf_notify_auth_frame_rx(struct brcmf_ return -EINVAL; } + if (mgmt_frame_len < offsetof(struct ieee80211_mgmt, u)) { + bphy_err(drvr, "Event %s (%d) frame too small. Ignore\n", + brcmf_fweh_event_name(e->event_code), e->event_code); + return -EINVAL; + } + wdev = &ifp->vif->wdev; WARN_ON(!wdev);