From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.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 BCFE732B10F for ; Sat, 18 Jul 2026 18:55:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784400926; cv=none; b=Z89diaHndfnmS8anMKSOEfxpN+qLHjg6mpHA8j8WkI2eoxIfSwV2SRn5CBglyup/qF1UCNnJUVI3P5feeL66+AFhvseSsiRjSCkNXNS12vAl3BW3IfTgARXU1pnrQME4lMS9iCl9uGTpJu67wJJT5TsE+Z6lXuGQNairJxX6nUs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784400926; c=relaxed/simple; bh=H1uaarUT/CzOlIYk85IhS6PC1+AMvnoZlaiNlT42aGw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nRRtHAJOgjtWWLT3kdYD6UGUWbQ/Y5mo2ELTWy2mOUbrWqjl00OokV4J8+Y7fBeJ1I00prwrWGufs0bwYcECizq10D7reVZVFY7kVhiDawel/1dQUggiByNgfdRkt9elHHfoKwBCEYMfK80by36zcsZidqil+TRjumQcbmrvKc0= 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=eSIcEWuD; arc=none smtp.client-ip=209.85.218.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="eSIcEWuD" Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-c1601d552a8so938029966b.2 for ; Sat, 18 Jul 2026 11:55:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784400921; x=1785005721; 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=eSIcEWuDgeaUsxQ+td6Kf+TmFn+sBYEr6v1YAcAuj50lpv2h2Yld0xwejTwlYlPM/N 4OdvtSCb9fz49BQQd6NLeGYdIMBVJuTCB0rFBIw440imAiKWCzyGPHUrqpMXMKmp3Vg1 LCvp/kyOmodllosoU6kBGqzLwP0AVnKhDZEvo90VVXXTo9178rF7eYIfuCXggOLlg7kb UsXuvD2NgiWEbOWqzHsym8WtatwJ0KdTD32GxOadQdP9VM8dk/dpq2e/NidtGdp8f576 0TFFzPm00Am/CkmD96bek2unxAfSRdl1uKm/z8Quo9hO04F1PJKEYtdItyIfbMhTSJn+ ReNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784400921; x=1785005721; 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=OtXAIkw1XP/Wy/Rm6/nSFv3w0b+PqYDmqlKAF6K+JxUXyiAMZVy5AB1D6cXB6U12fC d7TGTMG3oMZaXbLmnKTk5oXOCL789GkVN+edvvUwUS+G5k7AUz8RgHmvLX3uNig+t60z Mpa/Ms9stoA4cAR/jBp36pXRyIUUP2XAU/CTH0n+5Hl3BdkENAeAPXYr0lB+//6Ajwq7 RqAYNJxiqm3hUnov99oCVvc5EcK0TE37Q77mf92/2544ygeledYSrU9oqSY0nC/TaQDM R8MEDFtr2/oRxNjOp91HMOggcBNpOj37VN2sgLi44PUvMa/AAER8dmiVtlq8L+YpMn51 KTRA== X-Forwarded-Encrypted: i=1; AHgh+RpZF/pqW9GxYLG77Q8+Xm9HV+Nvrjg19ruHiSw8EtNwBTPvsXKdFTjbS5Gqr/ZN+hMnlKfsWzrkAOwvVW4=@vger.kernel.org X-Gm-Message-State: AOJu0YwfAfo5qLsbwC4snYyJ9APk+Rm1z5ONHmwn7KZkN3X9nfS5i3u/ se31zgEij31L+rq8Yl/AE193SezRbEH61sPeKSicNCDQgM1CmjxFPTg0 X-Gm-Gg: AfdE7clvsbp8EP8LlTco+kJaOm4aaFMVnhU9JwAs+6XQvEL6M3YOiZmSWa37I+kMuBr 4U6zOcY4GM5OvgOmP53rorIEAEESy4LQoGaqvg/Pq2QDQJGS6dw6Cg73BCxwjzah5Zip3B6ktRn HSj+N9pVXcqY3jEzRuKP78MyO1R/onuX/uOe9MJn/X1dOavsMZChhLrOZtjia43A0yJA4+RpA9h wRSatBfEKMzuVJGO8xR6vHuqKtscXw3gClwFHOWoeVb5ntOhQi+JlIsGZtk8hRY+t86ND4DUsB3 kvkfTmRFolXRKMS39PK6aFYE++Bx2yPYn7qNpp2VU/1i0GlD0zPlJf8iWXVswfXdRMawXVQE8ls m7fwy3n04DNJbmNp2bJhSstMb0REPAH+t/mFOXgBABAK3ZQUecjRnKGgoqjIzYRXooBEbi+ks8v rh9FdqBDvx4xMn3Qk8njfShczbxURU3eXsYhL3cC1IvH4ppylzK2B4dmI= X-Received: by 2002:a17:907:d11:b0:c16:5ae4:77a3 with SMTP id a640c23a62f3a-c16b4702bd7mr341127066b.25.1784400920942; Sat, 18 Jul 2026 11:55:20 -0700 (PDT) Received: from fedora ([202.47.63.86]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c1712a5f837sm249151866b.32.2026.07.18.11.55.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Jul 2026 11:55:20 -0700 (PDT) From: Muhammad Bilal To: Greg Kroah-Hartman Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Muhammad Bilal Subject: [PATCH 4/5] staging: rtl8723bs: fix OOB read in rtw_restruct_wmm_ie() Date: Sat, 18 Jul 2026 23:54:44 +0500 Message-ID: <20260718185445.63070-5-meatuni001@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260718185445.63070-1-meatuni001@gmail.com> References: <20260718185445.63070-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