public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Minu Jin <s9430939@naver.com>
Cc: gregkh@linuxfoundation.org, bqn9090@gmail.com,
	abrahamadekunle50@gmail.com, straube.linux@gmail.com,
	bryant.boatright@proton.me, davidzalman.101@gmail.com,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] staging: rtl8723bs: Fix potential race in expire_timeout_chk
Date: Thu, 29 Jan 2026 10:05:02 +0300	[thread overview]
Message-ID: <aXsGnpQ0RpsEebfu@stanley.mountain> (raw)
In-Reply-To: <20260129023214.1149822-1-s9430939@naver.com>

On Thu, Jan 29, 2026 at 11:32:14AM +0900, Minu Jin wrote:
> The expire_timeout_chk function currently do lock and unlock inside the
> loop before calling rtw_free_stainfo().
> 
> This can be risky as the list might be changed
> when the lock is briefly released.
> 
> To fix this, move expired sta_info entries into a local free_list while
> holding the lock, and then perform the actual freeing after the lock is
> released.
> 
> Signed-off-by: Minu Jin <s9430939@naver.com>
> ---
> Changes in v2:
>     - Use LIST_HEAD for init list (suggested by Dan Carpenter)
>     - Replace list_for_each_safe with list_for_each_entry_safe
>     - Clean up unused variable 'plist' and fix type of 'tmp' iterator.
>     - Remove redundant "free free_list" comment.

Sorry, you have gone overboard this time.  I only wanted you to clean up
the new code which you introduced in the patch.  Please don't clean up
the existing code in bugfix patch.  If you want to do that, it has to be
done separately.

> 
>  drivers/staging/rtl8723bs/core/rtw_ap.c | 27 ++++++++++++-------------
>  1 file changed, 13 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/staging/rtl8723bs/core/rtw_ap.c b/drivers/staging/rtl8723bs/core/rtw_ap.c
> index 67197c7d4a4d..d0a26134b67d 100644
> --- a/drivers/staging/rtl8723bs/core/rtw_ap.c
> +++ b/drivers/staging/rtl8723bs/core/rtw_ap.c
> @@ -172,45 +172,44 @@ static u8 chk_sta_is_alive(struct sta_info *psta)
>  
>  void expire_timeout_chk(struct adapter *padapter)
>  {
> -	struct list_head *phead, *plist, *tmp;
> +	struct list_head *phead;
>  	u8 updated = false;
> -	struct sta_info *psta = NULL;
> +	struct sta_info *psta = NULL, *tmp;
>  	struct sta_priv *pstapriv = &padapter->stapriv;
>  	u8 chk_alive_num = 0;
>  	char chk_alive_list[NUM_STA];
>  	int i;
>  
> +	LIST_HEAD(free_list);

Delete the blank line before "LIST_HEAD(free_list);"  Don't put a blank
line in the declaration block.

regards,
dan carpenter


  reply	other threads:[~2026-01-29  7:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-29  2:32 [PATCH v2] staging: rtl8723bs: Fix potential race in expire_timeout_chk Minu Jin
2026-01-29  7:05 ` Dan Carpenter [this message]
2026-01-29 12:33 ` [PATCH v3] staging: rtl8723bs: fix " Minu Jin
2026-01-30  9:07   ` 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=aXsGnpQ0RpsEebfu@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=abrahamadekunle50@gmail.com \
    --cc=bqn9090@gmail.com \
    --cc=bryant.boatright@proton.me \
    --cc=davidzalman.101@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=s9430939@naver.com \
    --cc=straube.linux@gmail.com \
    /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