Re: [PATCH v3] staging: rtl8723bs: fix potential race in expire_timeout_chk

From: Dan Carpenter

Date: Fri Jan 30 2026 - 04:08:34 EST


On Thu, Jan 29, 2026 at 09:33:42PM +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@xxxxxxxxx>
> ---
> Changes in v3:
> Suggested-by Dan Carpenter
> - Use list_for_each_entry_safe() only for the new code.
> - Remove blank line in the declaration block.
> - Keep existing code unchanged

Thanks!

Reviewed-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

regards,
dan carpenter