From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f172.google.com (mail-pg1-f172.google.com [209.85.215.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2DF773C060B for ; Tue, 7 Jul 2026 09:48:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783417717; cv=none; b=aJtX6F+lPpTLvYYRNiWYiN0+NudGlj1EqAUuQmtUDfjuOEY9qMTaWOsei+5xiFV3ifpbIdbQZFeIeIxiUOpk0A1UWZO/Rwl745hfJbUt/Ht0BveENzvlSnfvGIEP3Z+CWAmI4osB4Zu8Bd/arQO4tJLKg+lK3wZWQjX2EcKccYc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783417717; c=relaxed/simple; bh=vRz18SgEEOj8TQdJtXT9tGpbtIx0CYUiRJEM90Fpm0M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=AisGsnBscXQ1kv7u8mqDAMgyp+EQNaF0OAUNhHS9QVZc8B3MLhmt61DwTMNT4HAA/xBnXSV8jdsEHOQ5pczb1mwQUZz40w8kH1pSWe0OBsW/mWgKDMYd4btmnyQ6buqRypfWmP7iWBOLUbUU7r1bcuZRooPCTgX7RaQ2CaXIVY0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=SJ1PegD0; arc=none smtp.client-ip=209.85.215.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SJ1PegD0" Received: by mail-pg1-f172.google.com with SMTP id 41be03b00d2f7-c8894387780so2101916a12.2 for ; Tue, 07 Jul 2026 02:48:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783417715; x=1784022515; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to:content-type; bh=WHuPDXrv2XXNS07fUsoB0zQeifyt2lknu8CByaXQxnA=; b=SJ1PegD0G4A6f273ID1RyXmgiv0ZxSdokmX6AyzqeyTkwmSly0dvvSDENm1W1CWCXJ ZBdlr2Yq7vPDCSM31yYuMnu2gGV5ftdEgurbO2xPohEMd/KE4IzRqXwZE5P9iku5GsnA PbueMNPuujCus3BEYEV2OQig7a4BoN22ZUS5TLjHus9U5SYrad2N1eb16ph1AzXkNJLV k96d2bBhZuPKQzkYsJ3A7Z/W4Apv8DVWvC5hzCYeDZS4HSUQOqmGONhB0lDquxJAxjyD M9mYvLFr/ezdeIHgy01uDTpr4HGySVVmwlB4v/zGI+Gv3/7afj3h7kGrNBF2rKA6wz25 3a2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783417715; x=1784022515; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=WHuPDXrv2XXNS07fUsoB0zQeifyt2lknu8CByaXQxnA=; b=VE9FHcMe/BGW7MR3zMtsoggyvLeuK833tUDPk0IIk/3UaEDDRDB9+h/PzXx9quqdud tBXt/co+X9a2+pAspufr+dhfeC8F2sTTMBHcB2MtVjSinNPs/oVqD7pmEhzpc9CBoaZR or7OJBxNKzrjEV7koALBNbPZT4/WCuwsYiJCGWUEw8HJPCfsm97sBks9syQUvt83NoF1 7D1AZU35++b47691Sa/1rh5k99sL8H0HJb/c+FUTxqVfLfQ0dQ1hnZo8VpOA2HOnDhv7 8KYcKxrtRQjBZKUmMLLrn0wRdkIIQkjlOihZLRc5aDgadeDGoLkmGJUO7nWVZzZBPP3t Mrwg== X-Forwarded-Encrypted: i=1; AHgh+RqnzxebOpoumgPAmYEj92T8JQcMKkazZBGo8flT0Ztg23eD8hE142I6n6qhYpuelCsyqiVhdzvda+ZSTF8=@vger.kernel.org X-Gm-Message-State: AOJu0YwlIYf93k49KGGOj7VmDpXsULZDnXuQXesFXc/VMjUW36RKLbwo 67lNXVEqLGa30c7KUPxH38LeSpHw4IiAD6EmSXq449bUUrmX0/VAk6j7glWPQeRMu28= X-Gm-Gg: AfdE7clkkRYKsrz9m9AmAcUXkJ/bcPRo5K4q6ayxw0zPG3dg6pcRyD/LxVw8nk4oFDS bjVS5jN6YwwW5lywGFPDFyrqN2ylbwDmcaBrRAoZcxL+IxOqkdotWZD3a8ic9ywhOs1WKwtKNh4 0jCuzUjlWYa8lO2pEf1T33q6YsyMtqpV7n7m7q1xYX+NvqYVlGOIdckV46V9p9heer8gp2fecda v4LETwmCmQQHtuJWR86XGlznAIUXqzYsDkKMyqARLHFoxNlgZHVU0qGuCS7yRctq48/syuz+wvb mOy9CbnLQnE+GpqQIpLb3QbtNR92m3YL5P534F2jC7hsncSR6Ma+QaSowJZokfvH/7Pd6Ynielq ksri7yTc6Hqi6WuYJWwEAON/qFS375lyoEsdGuNoNNRAQ21jgDSFNQhooDB2Evua7+TBbVY2hNB 5QjB6IlfM3yaqWNEJ6d5nlJVk8/rtiBMsE9KKshn0nuIGKOvhvX34= X-Received: by 2002:a05:6a21:1f8d:b0:3c0:9c1a:894e with SMTP id adf61e73a8af0-3c09c1a9cb5mr2699654637.70.1783417715345; Tue, 07 Jul 2026 02:48:35 -0700 (PDT) Received: from localhost.localdomain ([192.197.201.174]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-13b659d7c8bsm6649122c88.12.2026.07.07.02.48.33 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 07 Jul 2026 02:48:35 -0700 (PDT) From: =?UTF-8?q?HE=20WEI=20=28=E3=82=AE=E3=82=AB=E3=82=AF=29?= To: Johannes Berg Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, =?UTF-8?q?HE=20WEI=20=28=E3=82=AE=E3=82=AB=E3=82=AF=29?= Subject: [PATCH v2] wifi: cfg80211: bound element ID read when checking non-inheritance Date: Tue, 7 Jul 2026 18:48:28 +0900 Message-ID: <20260707094828.16465-1-skyexpoc@gmail.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260626144543.5034-1-skyexpoc@gmail.com> References: <20260626144543.5034-1-skyexpoc@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. Changes in v2: - Fixed the Fixes tag to point to the correct commit f7dacfb11475b ("cfg80211: support non-inheritance element") - The bug was introduced in the original implementation in 2019, not in commit dfd9aa3e7a45 Fixes: f7dacfb11475b ("cfg80211: support non-inheritance element") Signed-off-by: HE WEI (ギカク) --- 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 05b7dc6b7..0a44856b1 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.43.0