From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (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 4298E3B71BA for ; Tue, 28 Jul 2026 12:55:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785243319; cv=none; b=FnBrAugKDPsT5RGN+OSmMVhnE9KTvn+RqrQZsq/EuH8zs2tk1khoQvrs3cRI0VqBJu32m5h1e6msGj4ZWNDIAzq79Hz81dbwK1bTmidSbzYLKk2mABttlEQyummxolhNgNAaoa+6Ge+iQZVmLQMdayjjyuPQRz0sSooU6tBwtVw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785243319; c=relaxed/simple; bh=H1uaarUT/CzOlIYk85IhS6PC1+AMvnoZlaiNlT42aGw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=V3EPLUcYGNPiglLWljMO+8tHjZh7Oek02MVNn064rxah+65Y9Nj4g+Nl6eLrEh2sxnBHFrW31sgoWoEFSM3cv1unnRcNfd6T8D+45ZWe3r6Wu8/7Y1SWQSmjj+c9++lTE+SQ4b8wtLzRMzVlMz6aKepASEX4Of42qihFnKTujEI= 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=PU9dm1OX; arc=none smtp.client-ip=209.85.128.41 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="PU9dm1OX" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-496b7622a83so19840405e9.2 for ; Tue, 28 Jul 2026 05:55:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785243316; x=1785848116; 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=c6Y+pKPXjSHKlGYu4KK+zrCXrOnM9HLfJHcJjmz+n5A=; b=PU9dm1OXqBWxrdbUB51hM9WydXTUkbliCdBifo4rocSTxeb85NlXay36LsJva0ZjLY HjY4Q5t5v0dY0P/d9gHXlOXXFPezCZYwyBPWpahz/MGrrszbbMEudSYjb4ELUOT+zDeO euSazQJqT1wiSkvv4c/uK/JVkEHf+ShMmGHF0BF8t5o5D22/3D3UrEqa7MxS68yjMZWU oW2AAeHGrmaW0YkYfqMQhvEubT/czV+sA8y5hiKD/F7uW+KDR6YBkuFWRc86F321q+xp HBdjZGuChVVO0iuj9oQuF4F0+215PhpTj+e6kA1uyLVDRd3mkBuVf0ZLVK5tMRuE/TA5 niZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785243316; x=1785848116; 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=c6Y+pKPXjSHKlGYu4KK+zrCXrOnM9HLfJHcJjmz+n5A=; b=Y53L1gAq9/kGjcwMFoqlKW+vOwafop3vCDqec1mUWDfvy1eyCa/yVvjiCfqzgKMCoy 58aQ40YmvvTs1vkQAAcixNrmnrfBG+NgWAl5WW/792zKjFpuV6BZrffLg1omvQ0FOeWd DoUvYAx9rM2Cozdjv9OB6Stn5IMVQI+uYs9l6KMoQkAb0ThjmSTfi7hGwj67bm/2plvc OlMTId2PmzcDeAp7xL5aDc2eAO46r7svA836F4kQj4TPft+C6vBj4srhwMhBy3/4JZ+j HVhrGcEveZkuMEFB3JOE6jbVUAOz7E+pPAaeWRbO6b+G+BPqVLr06CKuNemEuF60fG1g g+4Q== X-Forwarded-Encrypted: i=1; AHgh+RrF7RkyDkzhmjiXQGNKwM3s3PkkCK1EDjZZuNaZSiFhOu2pmPwKWXMtqeHJyjFmm0T0R8p2bpXUwSQAvKU=@vger.kernel.org X-Gm-Message-State: AOJu0YzBUCeOd8Ub67Izz9rW6PW8D2yodILkY5E5iNWuBVZvR0QN+MoA McUIZYwKRpXa1ALE0w8pvqRhrUc6RrKPqlgwG9FWp8jIU3HQ1fGsRVta X-Gm-Gg: AR+sD12931TgeuwG3BmwVPC/dIoGjKzG64vcRakA1mzsAMQe3naXUWywzkA8ZBkMiGs U9WWJ2bYaTGeUhKNIWPhMgOu3brWPtlgIBJNmnB9Thm49J5brq8RQx+JR9Qn5mhMFF5DpoTFfjR S2cnvbnt76BTabBSczn7WPDZfHNozJSb+vTXQqhV9Qe0KCSaAo1P7OvL5DUYWrys5kFpwQLSqg5 lr9uMUleu/BjhK8CzIW10grgagn6TUTLDeJiHy2iYbHlCLDsF2ZOVX7Q6kXGDgmdgNofv6hVVSM 00+UGsaK7hWCmdiFLx3mAvJcoa4xMqcwaMXOLYTqDfJBnXXFs9rrDApCGIsX/odM0+IWGWP2L5Q 1E5GzCaY2nasPjXGhzb44Jwgaaw4dBejHKLXcDmjo6aEg8kmcHyFp5T18cwHpRlqMRP4opukwrf AC81oIj7fh3TBVdWiQN8D02kv0K4bz6yLfifrJe/uF3iiBKkGphiNgF74= X-Received: by 2002:a05:600c:34c4:b0:495:8a1:7670 with SMTP id 5b1f17b1804b1-496c657ec72mr24247795e9.35.1785243316289; Tue, 28 Jul 2026 05:55:16 -0700 (PDT) Received: from fedora ([202.47.63.86]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-496c444304esm74096505e9.0.2026.07.28.05.55.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jul 2026 05:55:15 -0700 (PDT) From: Muhammad Bilal To: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Cc: gregkh@linuxfoundation.org, stable@vger.kernel.org, Muhammad Bilal Subject: [PATCH v2 3/3] staging: rtl8723bs: fix OOB read in rtw_restruct_wmm_ie() Date: Tue, 28 Jul 2026 17:54:56 +0500 Message-ID: <20260728125456.32359-4-meatuni001@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260728125456.32359-1-meatuni001@gmail.com> References: <20260728125456.32359-1-meatuni001@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 rtw_restruct_wmm_ie() scans in_ie for a WMM IE with: while (i < in_len) { ... if (i + 5 < in_len && in_ie[i] == 0xDD && ...) { ... break; } i += (in_ie[i + 1] + 2); /* to the next IE element */ } When the "i + 5 < in_len" match check fails simply because i is within 5 bytes of the end of the buffer (i.e. no WMM IE was found near the tail of in_ie), execution falls through to "i += (in_ie[i + 1] + 2)", which reads in_ie[i + 1]. If i == in_len - 1 at that point, this is a 1-byte out-of-bounds read of an attacker-influenced IE buffer built from association/scan data. Commit a75281626fc8f ("staging: rtl8723bs: fix potential out-of-bounds read in rtw_restruct_wmm_ie") added the "i + 5 < in_len" guard to the match condition itself, but did not add an equivalent guard before the fallthrough advance, so the same class of OOB read remained reachable through the non-matching path. Add an explicit bounds check before advancing to the next IE. Fixes: 554c0a3abf216 ("staging: Add rtl8723bs sdio wifi driver") Cc: stable@vger.kernel.org Signed-off-by: Muhammad Bilal --- drivers/staging/rtl8723bs/core/rtw_mlme.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c index 1196ec011455..7bdc5fe6dc8a 100644 --- a/drivers/staging/rtl8723bs/core/rtw_mlme.c +++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c @@ -1980,6 +1980,9 @@ int rtw_restruct_wmm_ie(struct adapter *adapter, u8 *in_ie, u8 *out_ie, uint in_ break; } + if (i + 1 >= in_len) + break; + i += (in_ie[i + 1] + 2); /* to the next IE element */ } -- 2.55.0