From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) (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 045553B9D9A for ; Wed, 8 Jul 2026 20:00:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783540808; cv=none; b=cWSqYTTkiru4R9ZAU3ZQ3KAwbij6xIl2/7Qu5maGxDCZGQnxmp/Wmcq4NO5b+1GEjpoA8qdkdUoJf8mHoEq9RqlmPAqYiLnMOV/kiWDBA9qghM4V/d6gYopHTRxrJYSplGrmQYsJLwTyFTIzdL/RzZdsGHIse6ulJGignLUAwCQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783540808; c=relaxed/simple; bh=DjR5LQ1tNI1HuSIMzpG5/0eIkvkw+hOuWNdmJ16ZyZk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pOq8uN8g7BGpAO3WtdWz/ef35fc8kWZdW48ibhSMxvLnHK7nu+fz8qiUXsvz10UOWTJiPmYTQGedPqf3kM94PFK2gEfwoqACbd8oUcbAwPCjT4LMOclQJ1XLIcSVyYXDIPJknRBLgDAh0Bj3sZgHtbc5kYx7DFquF4GUUcZrvEs= 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=NS1rrI2l; arc=none smtp.client-ip=209.85.216.54 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="NS1rrI2l" Received: by mail-pj1-f54.google.com with SMTP id 98e67ed59e1d1-38426d04bb4so171974a91.1 for ; Wed, 08 Jul 2026 13:00:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783540806; x=1784145606; darn=vger.kernel.org; h=content-transfer-encoding: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=hbBFKyXB4yXB0DD+UuWj3GkBzIqJgXli2HxNGrv0Y4U=; b=NS1rrI2lStZmfXKnVtsfWxKQEhM+fieJ8Lcd89HK/jc6hA4VGGirMy3ECyJA6Tni/G ipwB1yzWRDA+FEwMJfSJfgcXSoqDvGVgok793hODkXgfWd5/nP3KulBpTP8PbtVsaR5F n7BrphyTc8Ra8g/dswKj9D6L87FP/DaBJNimPtPatAN6uecfmpmFEWpRcdB3KV47Sm6K MiAvWP+Bw4NLCYtGhLCFATHQpf03lSSIFxPDbKkkMBb8Z5gz16j//F+xlya+OuICi873 KvPvsJ2Bk4XqpngU9Cj0hiuF5nuEtLtzF/eAicb3lobvI14ELkg5hlPqCkfvCFsYYgdR uS7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783540806; x=1784145606; h=content-transfer-encoding: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=hbBFKyXB4yXB0DD+UuWj3GkBzIqJgXli2HxNGrv0Y4U=; b=oyNk9aLMJkNsmodNTcjY0b4wE/uGxDLnQw4z4bnFgFKKCqwxQn6nErueXkxX4VsU6y eyoqEzhlrfr4tQumPeNxcmtoc9ytcU1oWgpyeTd6qAUjMUslpaOXYoihHSTUP9pyTC3Y DNEe0eePziVdHNcGe++mJgEx46ZDC6gj2wkSCsqV7mLCRL3z1i8jI49HyhCxQ4fH69IE odKvLjbLtyFjFnTyXzd4QnZjmT0/h8pYD/HikJueDs3n8yEJWPGCK9Bv+9kXR5pm1nYd ACNr1YpmzCkkU5nVOl+bP/A7etriV5DZvPQqO9Ia/0M7uIRPaiQscBBU511WYSVrlbB6 N25Q== X-Gm-Message-State: AOJu0Yz9PYVi56h7Of1qH4El6DQQazk3xyt2kHWOSgpRwLBfuFS//wGq RZIDcs+g3dPTjMmxirt/pjbcQYSEkh7XHR+Y3rYz9O4CPIO0CRLHVYXu X-Gm-Gg: AfdE7ckiO0CYwbQ9mNV7htXefUiZZFidVr/XrM2ZdsHroL7+mO1BGOmgUsn9AGWg/6J HxKtYM5cQsxHU8SBUYQfwEr/FGts/BMF17rhG+/63Qk9Huo34J0DD02PRMcFIGY4+xYjOm1d8Rx ObCYkcrGVxOz5Ql4DMDNLUMwtLp4wOzqdMKym6kvZ/N+wXQ6jyseQ2/1rHB2g1Ni8DABW806VO0 wmoijF0XnDcqwp7qCblOaPeq8Uy7TSgFxuYxPArVXbRk7mySKi/3yw4Mm4XZKsl5vLCAccxG9WX GQ8iJQDm+nOGoh/uPSWwas93arfFmn0P6pVtQZPmm+uva8y/y+d7FOHs7xD2KwFhZx/h8wjcy8Z fO0xnqaWuot/2yhDeCHhkVacky3k9YnXwAUQubs7tGWoS7IAt9VOkrVorP16m71KleiXCSbPng1 z5bbPQjHHqPm599fangfjFnRd36BdeyMud1cPmZfQnjW8DovSpIbyGitbhh4bdeeU= X-Received: by 2002:a17:90b:5746:b0:381:10a3:8b10 with SMTP id 98e67ed59e1d1-387d8ded9c0mr8619185a91.14.1783540806257; Wed, 08 Jul 2026 13:00:06 -0700 (PDT) Received: from KRHW1CJW23.bytedance.net ([139.177.225.228]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-31174a8f521sm22585395eec.22.2026.07.08.12.59.59 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 08 Jul 2026 13:00:05 -0700 (PDT) From: Zhao Li To: linux-wireless@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Miri Korenblit , Brian Norris , Francesco Dolcini , Johannes Berg , Jaewan Kim , Daniel Gabay , Emmanuel Grumbach , Benjamin Berg , Anjaneyulu , Peddolla Harshavardhan Reddy , Lorenzo Bianconi , John Crispin , Avinash Patil , Cathy Luo , "John W. Linville" , Aloka Dixit , Zhao Li Subject: [PATCH 5/8] wifi: mac80211: validate probe response countdown offsets Date: Thu, 9 Jul 2026 03:59:08 +0800 Message-ID: <20260708195911.84365-6-enderaoelyther@gmail.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260708195911.84365-1-enderaoelyther@gmail.com> References: <20260708195911.84365-1-enderaoelyther@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit ieee80211_set_beacon_cntdwn() writes the current countdown value into each configured counter offset. For the beacon it skips offset 0 as an unused entry and bounds each non-zero offset against the template length before writing. The AP probe-response branch reuses the same counter-offset array but indexes resp->data[] with neither the zero-sentinel skip nor the length check. A probe-response template whose countdown offset is 0 or points past resp->len therefore takes a stray or out-of-bounds write. Apply the same zero-sentinel and length checks the beacon path uses before writing the probe-response countdown byte. Fixes: 5f9404abdf2a ("mac80211: add support for BSS color change") Assisted-by: Codex:gpt-5 Assisted-by: Claude:opus-4.8 Signed-off-by: Zhao Li --- net/mac80211/tx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 91b14112e24f0..84b6eda46a8f0 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -5249,6 +5249,10 @@ static void ieee80211_set_beacon_cntdwn(struct ieee80211_sub_if_data *sdata, if (sdata->vif.type == NL80211_IFTYPE_AP && resp) { u16 *resp_offsets = resp->cntdwn_counter_offsets; + if (!resp_offsets[i]) + continue; + if (WARN_ON_ONCE(resp_offsets[i] >= resp->len)) + return; resp->data[resp_offsets[i]] = count; } } -- 2.50.1 (Apple Git-155)