[PATCH] staging: rtl8723bs: fix timer rescheduling in rtw_cmd callbacks
From: Ganesh Harshan
Date: Mon Jun 22 2026 - 19:05:31 EST
Ensure scan and association timers are deleted before being
rescheduled when command execution fails.
Without deleting the existing timer, multiple timer instances
may be active simultaneously, potentially leading to duplicate
timeout handling or unexpected behavior.
Use timer_delete_sync() to safely stop active timers before
rescheduling.
Signed-off-by: Ganesh Harshan <ganeshredcobra@xxxxxxxxx>
---
drivers/staging/rtl8723bs/core/rtw_cmd.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/rtl8723bs/core/rtw_cmd.c b/drivers/staging/rtl8723bs/core/rtw_cmd.c
index b932670f5d63..967c3258e0b8 100644
--- a/drivers/staging/rtl8723bs/core/rtw_cmd.c
+++ b/drivers/staging/rtl8723bs/core/rtw_cmd.c
@@ -1801,7 +1801,9 @@ void rtw_survey_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd)
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
if (pcmd->res != H2C_SUCCESS) {
- /* TODO: cancel timer and do timeout handler directly... */
+ /* Ensure timer is safely rescheduled */
+ if (timer_pending(&pmlmepriv->scan_to_timer))
+ timer_delete_sync(&pmlmepriv->scan_to_timer);
_set_timer(&pmlmepriv->scan_to_timer, 1);
}
@@ -1829,7 +1831,9 @@ void rtw_joinbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd)
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
if (pcmd->res != H2C_SUCCESS) {
- /* TODO: cancel timer and do timeout handler directly... */
+ /* Ensure timer is safely rescheduled */
+ if (timer_pending(&pmlmepriv->assoc_timer))
+ timer_delete_sync(&pmlmepriv->assoc_timer);
_set_timer(&pmlmepriv->assoc_timer, 1);
}
--
2.47.3