Linux kernel staging patches
 help / color / mirror / Atom feed
From: Ganesh Harshan <ganeshredcobra@gmail.com>
To: gregkh@linuxfoundation.org
Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
	khushalchitturi@gmail.com, dennylin0707@gmail.com,
	Ganesh Harshan <ganeshredcobra@gmail.com>
Subject: [PATCH] staging: rtl8723bs: fix timer rescheduling in rtw_cmd callbacks
Date: Mon, 22 Jun 2026 19:04:48 -0400	[thread overview]
Message-ID: <20260622230448.4138-1-ganeshredcobra@gmail.com> (raw)

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@gmail.com>
---
 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


             reply	other threads:[~2026-06-22 23:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-22 23:04 Ganesh Harshan [this message]
2026-06-23  8:58 ` [PATCH] staging: rtl8723bs: fix timer rescheduling in rtw_cmd callbacks Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260622230448.4138-1-ganeshredcobra@gmail.com \
    --to=ganeshredcobra@gmail.com \
    --cc=dennylin0707@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=khushalchitturi@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox