From mboxrd@z Thu Jan 1 00:00:00 1970 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 35EE83806D9; Thu, 30 Jul 2026 15:30: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=1785425453; cv=none; b=cIGawf4rgv0htZU3Yo2NpLJF8pZfiDh7Ee/GdOYvC6KXq6kj6BVmmeH6BfhgnS9tmXH84eg4ttZHMY6C9JvS9Uso5RHipygbvv117++xKXR140PKyopwQxvZL53OJlQ6NyHZG2Acieop76QARzkLo/3aYdrWJPy2dgOsRR/yP/g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785425453; c=relaxed/simple; bh=rm5QvrefWIhUG6PYAoVBo89LkFB+DhJD7gejX7yxhiM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=t6gHJePbWtCIG9d0kA59rSsoIZzh7VLvRR1ulucvJ4XgaPvafihPEVmUBO7p9GxJKp/vKZmNsmJ5p4/j5Zh+n0qPqFpkghYFyirTmG9N/B8sRoTfgFCdvEb9nBZDEqVIkJvuvZGWAr5mmBxDqLSsPpJS9gbDvpvfC0b+efCfTrU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ZOPNMvl4; 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="ZOPNMvl4" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8FE581F000E9; Thu, 30 Jul 2026 15:30:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1785425452; bh=Ri1ekoZNi4S911IBraHpdg2YJf1Z7/+3fixPALCKXSw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ZOPNMvl4Nmpz1aRYipQi6ETF9ZX/4xPpt4PD2e7Zn8pBt6XgVLPByBE396robG0x1 r/DCOGci15sNe48Wlnjf2DFmHVqvISTTjLso9JW25jPf32u9efPIJMxzGbRWV3Noq+ 3fNFtAlKNT9YjqScEiNy3evGcwoh4PHuomGN1o+k= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, =?UTF-8?q?HE=20WEI=20 ?= , Johannes Berg , Sasha Levin Subject: [PATCH 6.12 073/602] wifi: cfg80211: bound element ID read when checking non-inheritance Date: Thu, 30 Jul 2026 16:07:45 +0200 Message-ID: <20260730141437.533520702@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260730141435.976815864@linuxfoundation.org> References: <20260730141435.976815864@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-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: HE WEI (ギカク) [ Upstream commit cb8afea4655ff004fa7feee825d5c79783525383 ] cfg80211_is_element_inherited() reads the first data octet of the candidate element (id = elem->data[0]) to look it up in an extension non-inheritance list. It does so after testing elem->id, but without verifying that the element actually has a data octet. A zero-length extension element (WLAN_EID_EXTENSION with length 0) therefore makes it read one octet past the end of the element. _ieee802_11_parse_elems_full() runs this check for every element of a frame once a non-inheritance context exists -- e.g. while parsing a per-STA profile of a Multi-Link element in a (re)association response, or a non-transmitted BSS profile -- so a crafted frame from an AP can trigger a one-octet slab-out-of-bounds read during element parsing: BUG: KASAN: slab-out-of-bounds in cfg80211_is_element_inherited Read of size 1 ... in net/wireless/scan.c Return early (treat the element as inherited) when an extension element carries no data, mirroring the existing handling of empty ID lists. The bug was found by fuzzing ieee802_11_parse_elems_full() under KASAN. Fixes: f7dacfb11475 ("cfg80211: support non-inheritance element") Signed-off-by: HE WEI (ギカク) Link: https://patch.msgid.link/20260707094828.16465-1-skyexpoc@gmail.com Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/wireless/scan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/wireless/scan.c b/net/wireless/scan.c index b249f29454f9e1..3c439841578c49 100644 --- a/net/wireless/scan.c +++ b/net/wireless/scan.c @@ -205,7 +205,7 @@ bool cfg80211_is_element_inherited(const struct element *elem, return true; if (elem->id == WLAN_EID_EXTENSION) { - if (!ext_id_len) + if (!ext_id_len || !elem->datalen) return true; loop_len = ext_id_len; list = &non_inherit_elem->data[3 + id_len]; -- 2.53.0