From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 81582330B15; Tue, 17 Mar 2026 16:54:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773766482; cv=none; b=YZ2cmcBh3/B3SRNaiL7PmNBPMthgOckEltEbXGCvuOKxLJz9xkv0uKhkLiKoHtScbcvqSqLsS6C+ny7TTJ3t0SvI3+wd0Ag65lRw532chd4SNc430DanUWg01uHTa6AbwMlIiYVn/F75KorrLPRjdJYr4LfHhCo5iir1Tw+oAUI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773766482; c=relaxed/simple; bh=Baz5+yhNHkWJ/6DqRAguhhUaX58VkeGRLd3Sbg/0DAQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MGkUWMMDtlnKCHmayenKfqzFcnb65/CikmPkRuzJs6Y9rtiZuGiwM/pBdCsm9JVUVVSuy41rHhhpmgXDmD6GKXG3tEZkdl6Fo/wQb72pfE6EWbKM1nmzfbQQMhuCdCSJYhiC4sZGffD1p9jLqYqns7AnN8MLSg3J5AVvVEV1OSg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Kr7O92jd; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Kr7O92jd" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6BD2C4CEF7; Tue, 17 Mar 2026 16:54:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1773766482; bh=Baz5+yhNHkWJ/6DqRAguhhUaX58VkeGRLd3Sbg/0DAQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kr7O92jdzfqWdi7dMB7O529ncWMpmfD2B+I2qfR1YiqoLKO0an6I/bg+ifB+dAz7a CymRSC0oqBT+IeZ6JurcgE0YUzw8YdfRcLZjlmRDEBDsO3Av1hUe+LVXieeeqcppnP EDiZ2ARxp1nmAgd6KK8+6fctgmODs5uIFdtsWEFQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, stable , Luka Gejak , Dan Carpenter Subject: [PATCH 6.19 255/378] staging: rtl8723bs: fix potential out-of-bounds read in rtw_restruct_wmm_ie Date: Tue, 17 Mar 2026 17:33:32 +0100 Message-ID: <20260317163016.400453580@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260317163006.959177102@linuxfoundation.org> References: <20260317163006.959177102@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Luka Gejak commit a75281626fc8fa6dc6c9cc314ee423e8bc45203b upstream. The current code checks 'i + 5 < in_len' at the end of the if statement. However, it accesses 'in_ie[i + 5]' before that check, which can lead to an out-of-bounds read. Move the length check to the beginning of the conditional to ensure the index is within bounds before accessing the array. Fixes: 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver") Cc: stable Signed-off-by: Luka Gejak Reviewed-by: Dan Carpenter Link: https://patch.msgid.link/20260224132647.11642-2-luka.gejak@linux.dev Signed-off-by: Greg Kroah-Hartman --- drivers/staging/rtl8723bs/core/rtw_mlme.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/drivers/staging/rtl8723bs/core/rtw_mlme.c +++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c @@ -2002,7 +2002,10 @@ int rtw_restruct_wmm_ie(struct adapter * while (i < in_len) { ielength = initial_out_len; - if (in_ie[i] == 0xDD && in_ie[i+2] == 0x00 && in_ie[i+3] == 0x50 && in_ie[i+4] == 0xF2 && in_ie[i+5] == 0x02 && i+5 < in_len) { /* WMM element ID and OUI */ + if (i + 5 < in_len && + in_ie[i] == 0xDD && in_ie[i + 2] == 0x00 && + in_ie[i + 3] == 0x50 && in_ie[i + 4] == 0xF2 && + in_ie[i + 5] == 0x02) { for (j = i; j < i + 9; j++) { out_ie[ielength] = in_ie[j]; ielength++;