From nobody Sun Feb 8 18:48:42 2026 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (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 13DFF28DF2D for ; Thu, 29 Jan 2026 13:24:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769693065; cv=none; b=tIFdC7KHqie3teXLQV4HIgdA3scZY71njFHhehBDPgkNL+R9pAB9c+YuVlwrFmmmLjNnF18fjs+sVDfH2baqEOXhut7sytZSQvRlt0fzyHl2LmM4ZqCDhb0knwoP/GLib7clAf2wITvh2V++lqfKfOeirl7Om5ZBar803c5hgmk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769693065; c=relaxed/simple; bh=CoBTJI+JJqaoappzWQvcsHD6mJ/LATRC5Pew2Bil0ms=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kUIkZzN9wpBziFnn3RSyvZF87om3ew3IM/UKv4bBd1We9Jhso+UEqEq5IZIEerUQ3t5/NJ9Ye/BAA4ua3GC94mlKJC7A4pTN7nYCcr5YVnq0I9gA3tIOpEYbQutthp2j59PUdmClf4xlfRbzMVPWsNFFb5prxi0NucvdA32wC3g= 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=KadrIsFj; arc=none smtp.client-ip=209.85.128.52 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="KadrIsFj" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-4806bf39419so13180015e9.1 for ; Thu, 29 Jan 2026 05:24:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769693061; x=1770297861; 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=MEq21BVwFHS5FNpeSTGjaMWvoud1JJRBiNNr3IFX3lE=; b=KadrIsFjZR74lDHe1H1YDXqsuorjqjInTkRgkpmay105Fb49oZRQTR+O+qHqZ6N2HT WBknZ6sc0zdDfbEFcboXcbMK/eBrJp0FvfBqsJSicxl2pAs09kEvkWnLEIkL5nVe0UJG yGhQ0+dSTygV4J+pyFurz5ugB2ZS3ZCrMB+2sSpYQf63ZTv1O1vktPZ/I4RR24iqtJ20 PjCQYyuJT3bQ5yVPUQZMVdw4hNdE3rjwzgPLNirZwqWnqpAio8qvUhww3YtHB6EQJJNN P5bGYczp9ir/h+mL3PgWzYabW8O0O7eMBjivRbzRkeq+3jj8C2vEakbsGt6DXg2S+clW XAJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769693061; x=1770297861; 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=MEq21BVwFHS5FNpeSTGjaMWvoud1JJRBiNNr3IFX3lE=; b=Q+54f1jcCslsgepeJJ0tE3Dn65yFBNQPp1JDRvTg4lQMt14Dob01K/rc+U4P0rkdsa SZw3aKLwfERhmGv0yw0hYSfIr8H6KvWBW2q+b4JBWj6DdPmRDBUaXz0vJp9VKRBsXZRE fubxSNNaRodxr4lLsGhkss1MLHPyxyIyxVMClX0nz/gu6RgaKmaZKHu+MyZaSg+dgpl3 eYq0A/Xoz63nsahVCMHB5hdKqKrEIibWCKnbkCI1zZKtUFFTIf9n3ByQNXZUPTUomGI1 ouTCaVF7BTHDaGdZ9apRGY6Q22YP+C5S4/Y6w9EUfJKyLpDJWrlpzabXFzJf0CJvWkHV JI1g== X-Forwarded-Encrypted: i=1; AJvYcCXXV/21OlxtHV/0B7SWyFla6RylKn37kQtPbFjZ9K5T9tghA52qpFx4ZxBL5QkRR5Zv/PbVudL+TECxhIs=@vger.kernel.org X-Gm-Message-State: AOJu0YzcOLfhl+GAlpUCTesuWGSspWpqvrfFgBEWZPzuQetBCSzF3i8I TCqEU46FZu2NqiTlmM5TciS5ClD2jRl8YddtT5dx8F0udKkulkEvyzY= X-Gm-Gg: AZuq6aJY7qnXm+2CvpqWP/X43e3c6k8jJbrwmxvrOLXz8hWxYCmgCtxt7LJD87LIAgd +S83YWAenO9CuAl1u7ELxlGGriO0AcvvUL79GQk9mJHGkN/e2Q7Oz02EwRE43Vota2H7/EI50l0 DM8rr5UsHE8ZA83QWfhcp6W9M4Rv0+KcnAzepzQKnCN9y3CxaXxMO9jjrnDJw5Obpej0y1qaPR9 pJ0KS7PjB3eAFdXcJZttuohfuWzTqdSqSq8GWuHNHBfkAW36YWwJLi6h80yF5gGCfmlyHJXbMSw 4aJmToW3bEF+TvO+lvEugqqxufW5cz8WWv2/b0np+gCOr0pvoVuTJ+z6uzS1i/ijSkq6/AUjl+t Nge88h/Tc7zFXXTfclG9UXpJ6kUocnqMoIDjYeCQuy5nt+Ouv90m4Vixb46rwI7TsgIFHZoXjtF mw X-Received: by 2002:a05:600c:1910:b0:475:ddad:c3a9 with SMTP id 5b1f17b1804b1-480829b1c19mr42090625e9.13.1769693061388; Thu, 29 Jan 2026 05:24:21 -0800 (PST) Received: from LGPC ([31.223.131.52]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48066be7404sm217492315e9.1.2026.01.29.05.24.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jan 2026 05:24:20 -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 Subject: [PATCH v2 4/5] staging: rtl8723bs: fix out-of-bounds check in rtw_restruct_wmm_ie Date: Thu, 29 Jan 2026 14:23:51 +0100 Message-ID: <20260129132352.14615-5-lukagejak5@gmail.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260129132352.14615-1-lukagejak5@gmail.com> References: <20260129132352.14615-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" Add a length check before accessing the OUI in WMM IE to prevent potential out-of-bounds reads. Use memcmp() for better readability. Fixes: 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver") Signed-off-by: Luka Gejak --- drivers/staging/rtl8723bs/core/rtw_mlme.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rt= l8723bs/core/rtw_mlme.c index c4f58106b3bd..18a70879f78f 100644 --- a/drivers/staging/rtl8723bs/core/rtw_mlme.c +++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c @@ -2000,7 +2000,8 @@ 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 && + !memcmp(&in_ie[i + 2], "\x00\x50\xf2\x02", 4)) { for (j =3D i; j < i + 9; j++) { out_ie[ielength] =3D in_ie[j]; ielength++; --=20 2.52.0