From nobody Sun Feb 8 15:58:04 2026 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (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 A1B8031ED62 for ; Thu, 29 Jan 2026 15:57:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769702241; cv=none; b=j5KiC5vXk8LJyUA0xfJAIpPRVTXHTVYKX1Md7jyKehjxrjRktZJQ6plB17LY3sil+d0aCxZLI/abf5xr3jNJIK9uhRHiZO64Cju9hp1QwQ+dn5z7jE9bgyky+BO8ySociaPbNDlV3McxTfTxmqt8PeL9++j/B5iNLcguND4RRc4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769702241; c=relaxed/simple; bh=anusSg+ei2G8pY99kSNGBiFGkxTuVaDv4F/ejqaSEKI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mR3yocOJPvBA35qVl8CvJxVWzggBUSa6nDAMAOQrRb+/7pdggIWYDWuPwYNxSZ8BcFLa5zWmkVs9g0GP6tJ+JRt31rMfoF89QXAPe7zcWHUIC1e2oltJXDBU0+8rAwDvTidFoLs+E5J3FYf7d8HWSrT7jNjE0k9SDrYl//kwOXg= 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=a7PD6lz8; arc=none smtp.client-ip=209.85.221.42 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="a7PD6lz8" Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-42fed090e5fso984568f8f.1 for ; Thu, 29 Jan 2026 07:57:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769702238; x=1770307038; 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; bh=YkmQJfRqTQzrHHgjjnSwxvqZrCWnUDQPc30Wk1HVPk4=; b=a7PD6lz8Ttc8xY24wgLcsybL4FceJfvmLfImntsDRxyWJRtSjZXZSPodY3YCIiIYUL VZ9EeeEJH1bKfTHHOvUvFFh47JhMQCzcI3dAu42fCVQwASfDecQSqG4bf/VF4mG/GZ3d i3CCV0mIil6sGdTNgJSYmhdncnaGQ3EOzH4lwmGTWHHtAru3I70+5NEZCs3d6ay9Upau i3u+ZAYcHXqWyi9Oy9WEXW3vfHUk6v5t0oL/v1Npx40cw2CNN1STX/5TOCEq3MPspSXQ v+uC0n+zFqOpOGV8FvlFDxv2sVq/CTA70wYzpMeCevQjHlQA6fWp8f4DwLLKXvCr8md1 exRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769702238; x=1770307038; 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; bh=YkmQJfRqTQzrHHgjjnSwxvqZrCWnUDQPc30Wk1HVPk4=; b=OnC8SwPM3OqA1tamYGJjDh9AwAaTQQljhSKjKkyvLXLKnkAdThpfjGAk9zCwipBw0u lpJq+wReyN73XpVNIO+Zrf84KqXELs8I6k+RiX8GRJvVNYJ7nPb9d12vAdEQbuzZI6t6 GezvVnyS/1Jmuki3AC2Orij3qmqrcuNBqEzOF9lBYG4YCIESBJKv5qxX/+AkRGwzTUUT /uuG7PAoT76UONme8F9grN61NUGZ73kygZYuNQUCAHzCmN6QDG1YBqPxPhTIFJne5Yku ua0qvJscnbhR5wIp9rsg8887lUgK3lrCEXrYEr6Bo/EQpMrQ7wXD4ZUlv/ipi7AD37hr P19Q== X-Forwarded-Encrypted: i=1; AJvYcCWeBsmZRD4wIjMAZo45ydKk8BSCUAOtpGDGuZeSawIgrIiYkCCo5lNQ8AOYbfaJMjCQ0uH9eQZjHcDfp3o=@vger.kernel.org X-Gm-Message-State: AOJu0YwwIy1BUmXxJsFq+2mbyHz1+CjLSHYxR72/sHBZ/LCRNTqEFRpN QvkqFamb8HvNHz8rY0dbOSsHw5/3De7FIRQh2xPkNP2DSZLkjHZI4b4= X-Gm-Gg: AZuq6aIcewhUFHBDWLq98bKG9SqsZ4P+zakmK22FSS2N9u+CWkUp+L4UOHEMenSwjLk FMwVedWVaPAB1Z6hJm0gohSBuxgO4f83hY+IxjBacQ/kcciw/OgosBVEgFWS+jwx1Hn37w6IH57 +Gv14nDimMcoiBLq4KKH9Fm1wXOJ2V/9LrRnXoC2rFzk8n0lviU0eLRF62qEXv0YagGVC8LfTo2 GBhaMvvEw4QZ52DPZEGTgca3y7LWACTw2RX5Ua4ur82tEoyAWDpnS6xjHIO8rE2JkMixSsM+1JH cQKqTZ+Za9pfKJZBJygbJzOauMMv/iELmjs8DNYE5vX2+ya3nXy8OtVv9JHJ4+Ur9ju1KJsay0H iNqFpWE9EJ+idcInFpFvTto94ZADKc3iCCe+tZZa4vhhmP6IXlLbuwE1JnR7siyme2Mt/pRorNU HVaBwsommiP2w= X-Received: by 2002:a05:6000:2c04:b0:431:5ca:c1a9 with SMTP id ffacd0b85a97d-435f3a8b7bcmr106781f8f.23.1769702237655; Thu, 29 Jan 2026 07:57:17 -0800 (PST) Received: from LGPC ([31.223.131.52]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-435e10ee078sm15749231f8f.16.2026.01.29.07.57.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jan 2026 07:57:16 -0800 (PST) From: Luka Gejak To: gregkh@linuxfoundation.org Cc: straube.linux@gmail.com, dan.carpenter@linaro.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Luka Gejak , stable@vger.kernel.org Subject: [PATCH v3 1/5] staging: rtl8723bs: fix potential out-of-bounds read in rtw_restruct_wmm_ie Date: Thu, 29 Jan 2026 16:56:50 +0100 Message-ID: <20260129155654.5565-2-lukagejak5@gmail.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260129155654.5565-1-lukagejak5@gmail.com> References: <20260129155654.5565-1-lukagejak5@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: quoted-printable Content-Type: text/plain; charset="utf-8" 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@vger.kernel.org Signed-off-by: Luka Gejak --- drivers/staging/rtl8723bs/core/rtw_mlme.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rt= l8723bs/core/rtw_mlme.c index 98704179ad35..7dfc2678924e 100644 --- a/drivers/staging/rtl8723bs/core/rtw_mlme.c +++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c @@ -2000,7 +2000,10 @@ int rtw_restruct_wmm_ie(struct adapter *adapter, u8 = *in_ie, u8 *out_ie, uint in_ while (i < in_len) { ielength =3D initial_out_len; =20 - if (in_ie[i] =3D=3D 0xDD && in_ie[i+2] =3D=3D 0x00 && in_ie[i+3] =3D=3D = 0x50 && in_ie[i+4] =3D=3D 0xF2 && in_ie[i+5] =3D=3D 0x02 && i+5 < in_len) = { /* WMM element ID and OUI */ + if (i + 5 < in_len && + in_ie[i] =3D=3D 0xDD && in_ie[i + 2] =3D=3D 0x00 && + in_ie[i + 3] =3D=3D 0x50 && in_ie[i + 4] =3D=3D 0xF2 && + in_ie[i + 5] =3D=3D 0x02) { for (j =3D i; j < i + 9; j++) { out_ie[ielength] =3D in_ie[j]; ielength++; --=20 2.52.0