* [PATCH v2 0/5] staging: rtl8723bs: Cleanups and security fix
@ 2026-01-29 13:23 Luka Gejak
2026-01-29 13:23 ` [PATCH v2 1/5] staging: rtl8723bs: rename u1bTmp to val Luka Gejak
` (4 more replies)
0 siblings, 5 replies; 9+ messages in thread
From: Luka Gejak @ 2026-01-29 13:23 UTC (permalink / raw)
To: gregkh
Cc: straube.linux, dan.carpenter, linux-staging, linux-kernel,
Luka Gejak
This series refactors the rtl8723bs driver for better compliance with
kernel coding standards and fixes a potential out-of-bounds read.
Changes in v2:
Split u1bTmp rename and spacing fixes into two separate patches.
Split hex modernization and the WMM bugfix into two separate patches.
Added a Fixes: tag to the WMM bugfix (Patch 4).
Removed an unused variable and dead debugging code (Patch 5).
Luka Gejak (5):
staging: rtl8723bs: rename u1bTmp to val
staging: rtl8723bs: fix spacing around operators
staging: rtl8723bs: modernize hex output in rtw_report_sec_ie
staging: rtl8723bs: fix out-of-bounds check in rtw_restruct_wmm_ie
staging: rtl8723bs: remove dead debugging code in rtw_mlme_ext.c
drivers/staging/rtl8723bs/core/rtw_mlme.c | 6 ++--
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 9 ------
.../staging/rtl8723bs/hal/rtl8723b_hal_init.c | 32 +++++++++----------
drivers/staging/rtl8723bs/hal/sdio_halinit.c | 32 +++++++++----------
4 files changed, 35 insertions(+), 44 deletions(-)
--
2.52.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 1/5] staging: rtl8723bs: rename u1bTmp to val
2026-01-29 13:23 [PATCH v2 0/5] staging: rtl8723bs: Cleanups and security fix Luka Gejak
@ 2026-01-29 13:23 ` Luka Gejak
2026-01-29 13:23 ` [PATCH v2 2/5] staging: rtl8723bs: fix spacing around operators Luka Gejak
` (3 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Luka Gejak @ 2026-01-29 13:23 UTC (permalink / raw)
To: gregkh
Cc: straube.linux, dan.carpenter, linux-staging, linux-kernel,
Luka Gejak
Rename the variable u1bTmp to val to remove Hungarian notation.
This improves readability and aligns the
code with kernel naming standards.
Signed-off-by: Luka Gejak <lukagejak5@gmail.com>
---
.../staging/rtl8723bs/hal/rtl8723b_hal_init.c | 12 +++----
drivers/staging/rtl8723bs/hal/sdio_halinit.c | 32 +++++++++----------
2 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
index 57c83f332e74..d75a63fd8a6b 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
@@ -259,7 +259,7 @@ static s32 _FWFreeToGo(struct adapter *adapter, u32 min_cnt, u32 timeout_ms)
void rtl8723b_FirmwareSelfReset(struct adapter *padapter)
{
struct hal_com_data *pHalData = GET_HAL_DATA(padapter);
- u8 u1bTmp;
+ u8 val;
u8 Delay = 100;
if (
@@ -268,19 +268,19 @@ void rtl8723b_FirmwareSelfReset(struct adapter *padapter)
/* 0x1cf = 0x20. Inform 8051 to reset. 2009.12.25. tynli_test */
rtw_write8(padapter, REG_HMETFR+3, 0x20);
- u1bTmp = rtw_read8(padapter, REG_SYS_FUNC_EN+1);
- while (u1bTmp & BIT2) {
+ val = rtw_read8(padapter, REG_SYS_FUNC_EN+1);
+ while (val & BIT2) {
Delay--;
if (Delay == 0)
break;
udelay(50);
- u1bTmp = rtw_read8(padapter, REG_SYS_FUNC_EN+1);
+ val = rtw_read8(padapter, REG_SYS_FUNC_EN+1);
}
if (Delay == 0) {
/* force firmware reset */
- u1bTmp = rtw_read8(padapter, REG_SYS_FUNC_EN+1);
- rtw_write8(padapter, REG_SYS_FUNC_EN+1, u1bTmp&(~BIT2));
+ val = rtw_read8(padapter, REG_SYS_FUNC_EN+1);
+ rtw_write8(padapter, REG_SYS_FUNC_EN+1, val&(~BIT2));
}
}
}
diff --git a/drivers/staging/rtl8723bs/hal/sdio_halinit.c b/drivers/staging/rtl8723bs/hal/sdio_halinit.c
index 4e81ef53dc47..c774a9009e95 100644
--- a/drivers/staging/rtl8723bs/hal/sdio_halinit.c
+++ b/drivers/staging/rtl8723bs/hal/sdio_halinit.c
@@ -589,7 +589,7 @@ u32 rtl8723bs_hal_init(struct adapter *padapter)
struct hal_com_data *pHalData;
struct pwrctrl_priv *pwrctrlpriv;
u32 NavUpper = WiFiNavUpperUs;
- u8 u1bTmp;
+ u8 val;
pHalData = GET_HAL_DATA(padapter);
pwrctrlpriv = adapter_to_pwrctl(padapter);
@@ -780,9 +780,9 @@ u32 rtl8723bs_hal_init(struct adapter *padapter)
pHalData->SdioTxOQTMaxFreeSpace = pHalData->SdioTxOQTFreeSpace;
/* Enable MACTXEN/MACRXEN block */
- u1bTmp = rtw_read8(padapter, REG_CR);
- u1bTmp |= (MACTXEN | MACRXEN);
- rtw_write8(padapter, REG_CR, u1bTmp);
+ val = rtw_read8(padapter, REG_CR);
+ val |= (MACTXEN | MACRXEN);
+ rtw_write8(padapter, REG_CR, val);
rtw_hal_set_hwreg(padapter, HW_VAR_NAV_UPPER, (u8 *)&NavUpper);
@@ -848,7 +848,7 @@ u32 rtl8723bs_hal_init(struct adapter *padapter)
/* */
static void CardDisableRTL8723BSdio(struct adapter *padapter)
{
- u8 u1bTmp;
+ u8 val;
u8 bMacPwrCtrlOn;
/* Run LPS WL RFOFF flow */
@@ -856,26 +856,26 @@ static void CardDisableRTL8723BSdio(struct adapter *padapter)
/* ==== Reset digital sequence ====== */
- u1bTmp = rtw_read8(padapter, REG_MCUFWDL);
- if ((u1bTmp & RAM_DL_SEL) && padapter->bFWReady) /* 8051 RAM code */
+ val = rtw_read8(padapter, REG_MCUFWDL);
+ if ((val & RAM_DL_SEL) && padapter->bFWReady) /* 8051 RAM code */
rtl8723b_FirmwareSelfReset(padapter);
/* Reset MCU 0x2[10]= 0. Suggested by Filen. 2011.01.26. by tynli. */
- u1bTmp = rtw_read8(padapter, REG_SYS_FUNC_EN + 1);
- u1bTmp &= ~BIT(2); /* 0x2[10], FEN_CPUEN */
- rtw_write8(padapter, REG_SYS_FUNC_EN + 1, u1bTmp);
+ val = rtw_read8(padapter, REG_SYS_FUNC_EN + 1);
+ val &= ~BIT(2); /* 0x2[10], FEN_CPUEN */
+ rtw_write8(padapter, REG_SYS_FUNC_EN + 1, val);
/* MCUFWDL 0x80[1:0]= 0 */
/* reset MCU ready status */
rtw_write8(padapter, REG_MCUFWDL, 0);
/* Reset MCU IO Wrapper, added by Roger, 2011.08.30 */
- u1bTmp = rtw_read8(padapter, REG_RSV_CTRL + 1);
- u1bTmp &= ~BIT(0);
- rtw_write8(padapter, REG_RSV_CTRL + 1, u1bTmp);
- u1bTmp = rtw_read8(padapter, REG_RSV_CTRL + 1);
- u1bTmp |= BIT(0);
- rtw_write8(padapter, REG_RSV_CTRL+1, u1bTmp);
+ val = rtw_read8(padapter, REG_RSV_CTRL + 1);
+ val &= ~BIT(0);
+ rtw_write8(padapter, REG_RSV_CTRL + 1, val);
+ val = rtw_read8(padapter, REG_RSV_CTRL + 1);
+ val |= BIT(0);
+ rtw_write8(padapter, REG_RSV_CTRL+1, val);
/* ==== Reset digital sequence end ====== */
--
2.52.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 2/5] staging: rtl8723bs: fix spacing around operators
2026-01-29 13:23 [PATCH v2 0/5] staging: rtl8723bs: Cleanups and security fix Luka Gejak
2026-01-29 13:23 ` [PATCH v2 1/5] staging: rtl8723bs: rename u1bTmp to val Luka Gejak
@ 2026-01-29 13:23 ` Luka Gejak
2026-01-29 13:23 ` [PATCH v2 3/5] staging: rtl8723bs: modernize hex output in rtw_report_sec_ie Luka Gejak
` (2 subsequent siblings)
4 siblings, 0 replies; 9+ messages in thread
From: Luka Gejak @ 2026-01-29 13:23 UTC (permalink / raw)
To: gregkh
Cc: straube.linux, dan.carpenter, linux-staging, linux-kernel,
Luka Gejak
Fix coding style issues by adding missing spaces around operators.
Signed-off-by: Luka Gejak <lukagejak5@gmail.com>
---
.../staging/rtl8723bs/hal/rtl8723b_hal_init.c | 28 +++++++++----------
drivers/staging/rtl8723bs/hal/sdio_halinit.c | 2 +-
2 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
index d75a63fd8a6b..ae5e4980ed06 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
@@ -17,8 +17,8 @@ static void _FWDownloadEnable(struct adapter *padapter, bool enable)
if (enable) {
/* 8051 enable */
- tmp = rtw_read8(padapter, REG_SYS_FUNC_EN+1);
- rtw_write8(padapter, REG_SYS_FUNC_EN+1, tmp|0x04);
+ tmp = rtw_read8(padapter, REG_SYS_FUNC_EN + 1);
+ rtw_write8(padapter, REG_SYS_FUNC_EN + 1, tmp | 0x04);
tmp = rtw_read8(padapter, REG_MCUFWDL);
rtw_write8(padapter, REG_MCUFWDL, tmp|0x01);
@@ -158,23 +158,23 @@ void _8051Reset8723(struct adapter *padapter)
/* Reset 8051(WLMCU) IO wrapper */
/* 0x1c[8] = 0 */
/* Suggested by Isaac@SD1 and Gimmy@SD1, coding by Lucas@20130624 */
- io_rst = rtw_read8(padapter, REG_RSV_CTRL+1);
+ io_rst = rtw_read8(padapter, REG_RSV_CTRL + 1);
io_rst &= ~BIT(0);
- rtw_write8(padapter, REG_RSV_CTRL+1, io_rst);
+ rtw_write8(padapter, REG_RSV_CTRL + 1, io_rst);
- cpu_rst = rtw_read8(padapter, REG_SYS_FUNC_EN+1);
+ cpu_rst = rtw_read8(padapter, REG_SYS_FUNC_EN + 1);
cpu_rst &= ~BIT(2);
- rtw_write8(padapter, REG_SYS_FUNC_EN+1, cpu_rst);
+ rtw_write8(padapter, REG_SYS_FUNC_EN + 1, cpu_rst);
/* Enable 8051 IO wrapper */
/* 0x1c[8] = 1 */
- io_rst = rtw_read8(padapter, REG_RSV_CTRL+1);
+ io_rst = rtw_read8(padapter, REG_RSV_CTRL + 1);
io_rst |= BIT(0);
- rtw_write8(padapter, REG_RSV_CTRL+1, io_rst);
+ rtw_write8(padapter, REG_RSV_CTRL + 1, io_rst);
- cpu_rst = rtw_read8(padapter, REG_SYS_FUNC_EN+1);
+ cpu_rst = rtw_read8(padapter, REG_SYS_FUNC_EN + 1);
cpu_rst |= BIT(2);
- rtw_write8(padapter, REG_SYS_FUNC_EN+1, cpu_rst);
+ rtw_write8(padapter, REG_SYS_FUNC_EN + 1, cpu_rst);
}
u8 g_fwdl_chksum_fail;
@@ -268,19 +268,19 @@ void rtl8723b_FirmwareSelfReset(struct adapter *padapter)
/* 0x1cf = 0x20. Inform 8051 to reset. 2009.12.25. tynli_test */
rtw_write8(padapter, REG_HMETFR+3, 0x20);
- val = rtw_read8(padapter, REG_SYS_FUNC_EN+1);
+ val = rtw_read8(padapter, REG_SYS_FUNC_EN + 1);
while (val & BIT2) {
Delay--;
if (Delay == 0)
break;
udelay(50);
- val = rtw_read8(padapter, REG_SYS_FUNC_EN+1);
+ val = rtw_read8(padapter, REG_SYS_FUNC_EN + 1);
}
if (Delay == 0) {
/* force firmware reset */
- val = rtw_read8(padapter, REG_SYS_FUNC_EN+1);
- rtw_write8(padapter, REG_SYS_FUNC_EN+1, val&(~BIT2));
+ val = rtw_read8(padapter, REG_SYS_FUNC_EN + 1);
+ rtw_write8(padapter, REG_SYS_FUNC_EN + 1, val & (~BIT2));
}
}
}
diff --git a/drivers/staging/rtl8723bs/hal/sdio_halinit.c b/drivers/staging/rtl8723bs/hal/sdio_halinit.c
index c774a9009e95..668616efa68a 100644
--- a/drivers/staging/rtl8723bs/hal/sdio_halinit.c
+++ b/drivers/staging/rtl8723bs/hal/sdio_halinit.c
@@ -875,7 +875,7 @@ static void CardDisableRTL8723BSdio(struct adapter *padapter)
rtw_write8(padapter, REG_RSV_CTRL + 1, val);
val = rtw_read8(padapter, REG_RSV_CTRL + 1);
val |= BIT(0);
- rtw_write8(padapter, REG_RSV_CTRL+1, val);
+ rtw_write8(padapter, REG_RSV_CTRL + 1, val);
/* ==== Reset digital sequence end ====== */
--
2.52.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 3/5] staging: rtl8723bs: modernize hex output in rtw_report_sec_ie
2026-01-29 13:23 [PATCH v2 0/5] staging: rtl8723bs: Cleanups and security fix Luka Gejak
2026-01-29 13:23 ` [PATCH v2 1/5] staging: rtl8723bs: rename u1bTmp to val Luka Gejak
2026-01-29 13:23 ` [PATCH v2 2/5] staging: rtl8723bs: fix spacing around operators Luka Gejak
@ 2026-01-29 13:23 ` Luka Gejak
2026-01-29 13:23 ` [PATCH v2 4/5] staging: rtl8723bs: fix out-of-bounds check in rtw_restruct_wmm_ie Luka Gejak
2026-01-29 13:23 ` [PATCH v2 5/5] staging: rtl8723bs: remove dead debugging code in rtw_mlme_ext.c Luka Gejak
4 siblings, 0 replies; 9+ messages in thread
From: Luka Gejak @ 2026-01-29 13:23 UTC (permalink / raw)
To: gregkh
Cc: straube.linux, dan.carpenter, linux-staging, linux-kernel,
Luka Gejak
Replace the manual hex-printing loop with the standard
kernel '%*ph' format string. This simplifies
the code and uses modern logging practices.
Signed-off-by: Luka Gejak <lukagejak5@gmail.com>
---
drivers/staging/rtl8723bs/core/rtw_mlme.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme.c b/drivers/staging/rtl8723bs/core/rtw_mlme.c
index 98704179ad35..c4f58106b3bd 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme.c
@@ -2084,8 +2084,7 @@ static void rtw_report_sec_ie(struct adapter *adapter, u8 authmode, u8 *sec_ie)
len = sec_ie[1] + 2;
len = (len < IW_CUSTOM_MAX) ? len : IW_CUSTOM_MAX;
- for (i = 0; i < len; i++)
- p += scnprintf(p, IW_CUSTOM_MAX - (p - buff), "%02x", sec_ie[i]);
+ p += scnprintf(p, IW_CUSTOM_MAX - (p - buff), " %*ph", len, sec_ie);
p += scnprintf(p, IW_CUSTOM_MAX - (p - buff), ")");
--
2.52.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 4/5] staging: rtl8723bs: fix out-of-bounds check in rtw_restruct_wmm_ie
2026-01-29 13:23 [PATCH v2 0/5] staging: rtl8723bs: Cleanups and security fix Luka Gejak
` (2 preceding siblings ...)
2026-01-29 13:23 ` [PATCH v2 3/5] staging: rtl8723bs: modernize hex output in rtw_report_sec_ie Luka Gejak
@ 2026-01-29 13:23 ` Luka Gejak
2026-01-29 14:13 ` Greg KH
2026-01-29 13:23 ` [PATCH v2 5/5] staging: rtl8723bs: remove dead debugging code in rtw_mlme_ext.c Luka Gejak
4 siblings, 1 reply; 9+ messages in thread
From: Luka Gejak @ 2026-01-29 13:23 UTC (permalink / raw)
To: gregkh
Cc: straube.linux, dan.carpenter, linux-staging, linux-kernel,
Luka Gejak
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 <lukagejak5@gmail.com>
---
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/rtl8723bs/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 = 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 &&
+ !memcmp(&in_ie[i + 2], "\x00\x50\xf2\x02", 4)) {
for (j = i; j < i + 9; j++) {
out_ie[ielength] = in_ie[j];
ielength++;
--
2.52.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v2 5/5] staging: rtl8723bs: remove dead debugging code in rtw_mlme_ext.c
2026-01-29 13:23 [PATCH v2 0/5] staging: rtl8723bs: Cleanups and security fix Luka Gejak
` (3 preceding siblings ...)
2026-01-29 13:23 ` [PATCH v2 4/5] staging: rtl8723bs: fix out-of-bounds check in rtw_restruct_wmm_ie Luka Gejak
@ 2026-01-29 13:23 ` Luka Gejak
4 siblings, 0 replies; 9+ messages in thread
From: Luka Gejak @ 2026-01-29 13:23 UTC (permalink / raw)
To: gregkh
Cc: straube.linux, dan.carpenter, linux-staging, linux-kernel,
Luka Gejak
Remove the unused local variable 'pattrib' and the
unreachable 'if (0)' debug block in OnAction_sa_query
to clean up the driver code.
Signed-off-by: Luka Gejak <lukagejak5@gmail.com>
---
drivers/staging/rtl8723bs/core/rtw_mlme_ext.c | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
index ac49bfbaa5bb..b61841bf16a5 100644
--- a/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723bs/core/rtw_mlme_ext.c
@@ -1849,7 +1849,6 @@ unsigned int OnAction_ht(struct adapter *padapter, union recv_frame *precv_frame
unsigned int OnAction_sa_query(struct adapter *padapter, union recv_frame *precv_frame)
{
u8 *pframe = precv_frame->u.hdr.rx_data;
- struct rx_pkt_attrib *pattrib = &precv_frame->u.hdr.attrib;
struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
unsigned short tid;
@@ -1865,14 +1864,6 @@ unsigned int OnAction_sa_query(struct adapter *padapter, union recv_frame *precv
default:
break;
}
- if (0) {
- int pp;
-
- netdev_dbg(padapter->pnetdev, "pattrib->pktlen = %d =>", pattrib->pkt_len);
- for (pp = 0; pp < pattrib->pkt_len; pp++)
- pr_cont(" %02x ", pframe[pp]);
- pr_cont("\n");
- }
return _SUCCESS;
}
--
2.52.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2 4/5] staging: rtl8723bs: fix out-of-bounds check in rtw_restruct_wmm_ie
2026-01-29 13:23 ` [PATCH v2 4/5] staging: rtl8723bs: fix out-of-bounds check in rtw_restruct_wmm_ie Luka Gejak
@ 2026-01-29 14:13 ` Greg KH
[not found] ` <CADRnA91+NQ=DLRSj+9SoTMBAEKDmzFiX98XR1+YCM2tgBiyDTQ@mail.gmail.com>
0 siblings, 1 reply; 9+ messages in thread
From: Greg KH @ 2026-01-29 14:13 UTC (permalink / raw)
To: Luka Gejak; +Cc: straube.linux, dan.carpenter, linux-staging, linux-kernel
On Thu, Jan 29, 2026 at 02:23:51PM +0100, Luka Gejak wrote:
> Add a length check before accessing the OUI in WMM
> IE to prevent potential out-of-bounds reads.
Is this really a bugfix? if so, it needs to go first, and be tagged for
stable trees.
> Use memcmp() for better readability.
>
> Fixes: 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver")
>
> Signed-off-by: Luka Gejak <lukagejak5@gmail.com>
> ---
> 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/rtl8723bs/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 = 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 &&
> + !memcmp(&in_ie[i + 2], "\x00\x50\xf2\x02", 4)) {
Very odd indentation :(
Also, why invert the i+5 check? And the memcmp check is now messier
than the original.
And is that where you are saying this is a security fix? If so, it's
just a read, not a write, so what is the security issue?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 4/5] staging: rtl8723bs: fix out-of-bounds check in rtw_restruct_wmm_ie
[not found] ` <CADRnA91+NQ=DLRSj+9SoTMBAEKDmzFiX98XR1+YCM2tgBiyDTQ@mail.gmail.com>
@ 2026-01-30 5:26 ` Greg KH
2026-01-30 5:56 ` Luka Gejak
0 siblings, 1 reply; 9+ messages in thread
From: Greg KH @ 2026-01-30 5:26 UTC (permalink / raw)
To: Luka Gejak; +Cc: straube.linux, dan.carpenter, linux-staging, linux-kernel
On Thu, Jan 29, 2026 at 04:35:29PM +0100, Luka Gejak wrote:
> Subject: Re: [PATCH v2 4/5] staging: rtl8723bs: fix out-of-bounds check in
> rtw_restruct_wmm_ie
> On Thu, Jan 29, 2026 at 02:23:51PM +0100, Greg Kroah-Hartman wrote:
<snip>
something went wrong with your reply, sorry, it was in html format and
all mushed together and not in the in-line response format, which is
rejected by the public mailing list. I'll be glad to respond if you
resend it in text-only and interleaved.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 4/5] staging: rtl8723bs: fix out-of-bounds check in rtw_restruct_wmm_ie
2026-01-30 5:26 ` Greg KH
@ 2026-01-30 5:56 ` Luka Gejak
0 siblings, 0 replies; 9+ messages in thread
From: Luka Gejak @ 2026-01-30 5:56 UTC (permalink / raw)
To: Greg KH; +Cc: straube.linux, dan.carpenter, linux-staging, linux-kernel
On Thu, Jan 29, 2026, Greg Kroah-Hartman wrote:
> Is this really a bugfix? if so, it needs to go first, and be tagged for
> stable trees.
Yes, it fixes a potential out-of-bounds read. I have moved it to the
beginning of the series (1/5) in v5 and added the Cc: stable tag.
> Also, why invert the i+5 check?
I moved the length check to the start of the condition to ensure
in_ie[i+5] is not accessed before the buffer bounds are verified.
> And the memcmp check is now messier than the original.
> Very odd indentation :(
Understood. For v3/v4, I have dropped the memcmp change entirely,
reverted to the original byte-by-byte comparison style, and
fixed the indentation.
IMPORTANT: in v3 I haven't deleted variable i that causes error
(-Wunused-variable) upon compiling. I have fixed that in v4
which was sent on Jan 29, 2026. I would also like to address
label issue you mentioned. If you consider it necessary I will
remove the security fix from name/label and submit v5 with such
change. I will be able to submit v5 if requested at about 13:00 UTC.
Thanks for the review,
Luka
On Fri, Jan 30, 2026 at 6:26 AM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Thu, Jan 29, 2026 at 04:35:29PM +0100, Luka Gejak wrote:
> > Subject: Re: [PATCH v2 4/5] staging: rtl8723bs: fix out-of-bounds check in
> > rtw_restruct_wmm_ie
> > On Thu, Jan 29, 2026 at 02:23:51PM +0100, Greg Kroah-Hartman wrote:
>
> <snip>
>
> something went wrong with your reply, sorry, it was in html format and
> all mushed together and not in the in-line response format, which is
> rejected by the public mailing list. I'll be glad to respond if you
> resend it in text-only and interleaved.
>
> thanks,
>
> greg k-h
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-01-30 5:56 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-29 13:23 [PATCH v2 0/5] staging: rtl8723bs: Cleanups and security fix Luka Gejak
2026-01-29 13:23 ` [PATCH v2 1/5] staging: rtl8723bs: rename u1bTmp to val Luka Gejak
2026-01-29 13:23 ` [PATCH v2 2/5] staging: rtl8723bs: fix spacing around operators Luka Gejak
2026-01-29 13:23 ` [PATCH v2 3/5] staging: rtl8723bs: modernize hex output in rtw_report_sec_ie Luka Gejak
2026-01-29 13:23 ` [PATCH v2 4/5] staging: rtl8723bs: fix out-of-bounds check in rtw_restruct_wmm_ie Luka Gejak
2026-01-29 14:13 ` Greg KH
[not found] ` <CADRnA91+NQ=DLRSj+9SoTMBAEKDmzFiX98XR1+YCM2tgBiyDTQ@mail.gmail.com>
2026-01-30 5:26 ` Greg KH
2026-01-30 5:56 ` Luka Gejak
2026-01-29 13:23 ` [PATCH v2 5/5] staging: rtl8723bs: remove dead debugging code in rtw_mlme_ext.c Luka Gejak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox